feat: Implement speaker analysis and EPUB 3 export functionality

- Added speaker analysis module to infer speaker identities from text chunks.
- Introduced SpeakerGuess and SpeakerAnalysis data classes for managing speaker data.
- Developed functions for analyzing speaker occurrences and confidence levels.
- Created EPUB 3 exporter to generate EPUB packages with synchronized narration and media overlays.
- Implemented configurable chunking options for TTS synthesis and EPUB alignment.
- Enhanced JavaScript for speaker preview functionality in the web interface.
- Added comprehensive tests for chunking and EPUB exporting features.
- Documented upgrade plan for transitioning to EPUB 3 with multi-speaker support.
This commit is contained in:
JB
2025-10-07 17:57:53 -07:00
parent bacf1b2f9e
commit 41f56a8491
18 changed files with 2844 additions and 14 deletions
+148 -1
View File
@@ -673,6 +673,112 @@ body {
font-weight: 500;
}
.prepare-speakers {
margin-top: 2rem;
border-top: 1px solid var(--panel-border);
padding-top: 1.5rem;
display: flex;
flex-direction: column;
gap: 1rem;
}
.speaker-list {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 1rem;
}
.speaker-list__item {
background: rgba(148, 163, 184, 0.05);
border: 1px solid var(--panel-border);
border-radius: 18px;
padding: 1rem 1.25rem;
display: flex;
flex-direction: column;
gap: 0.65rem;
}
.speaker-line {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.75rem;
}
.speaker-list__name {
font-weight: 600;
font-size: 1rem;
}
.speaker-list__preview {
font-size: 1.1rem;
line-height: 1;
width: 2.4rem;
height: 2.4rem;
display: flex;
align-items: center;
justify-content: center;
border-radius: 999px;
border: 1px solid var(--panel-border);
color: var(--accent);
background: rgba(56, 189, 248, 0.08);
transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.speaker-list__preview:hover {
border-color: var(--accent);
box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
transform: translateY(-1px);
}
.speaker-list__preview .spinner {
display: none;
}
.speaker-list__preview[data-loading="true"] .spinner {
display: inline-block;
}
.speaker-list__preview[data-loading="true"] .icon-button__glyph {
display: none;
}
.speaker-list__preview[data-loading="true"] {
cursor: progress;
box-shadow: none;
color: transparent;
}
.speaker-list__field {
display: flex;
flex-direction: column;
gap: 0.35rem;
}
.speaker-list__field input {
border-radius: 12px;
border: 1px solid var(--panel-border);
background: rgba(15, 23, 42, 0.6);
padding: 0.6rem 0.8rem;
color: var(--text);
font-size: 0.95rem;
}
.speaker-list__field input:focus {
outline: none;
border-color: var(--accent);
box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}
.speaker-list__stats {
margin: 0;
color: var(--muted);
font-size: 0.85rem;
}
.prepare-metadata h2 {
font-size: 1rem;
margin: 0 0 0.6rem;
@@ -1518,6 +1624,20 @@ input[data-state="locked"] {
box-shadow: none;
}
.icon-button--borderless {
background: transparent;
border-color: transparent;
}
.icon-button--borderless:hover {
background: rgba(148, 163, 184, 0.1);
border-color: rgba(148, 163, 184, 0.3);
}
.icon-button--borderless:focus-visible {
border-color: var(--accent);
}
.icon-button--primary {
background: linear-gradient(135deg, var(--accent), var(--accent-strong));
border: none;
@@ -1553,6 +1673,32 @@ input[data-state="locked"] {
box-shadow: none;
}
.spinner {
display: inline-block;
width: 1.1rem;
height: 1.1rem;
border-radius: 50%;
border: 2px solid rgba(148, 163, 184, 0.28);
border-top-color: var(--accent);
animation: spin 0.8s linear infinite;
}
.spinner--sm {
width: 0.85rem;
height: 0.85rem;
}
.spinner--lg {
width: 1.5rem;
height: 1.5rem;
border-width: 3px;
}
.spinner--muted {
border-color: rgba(148, 163, 184, 0.2);
border-top-color: rgba(148, 163, 184, 0.6);
}
.button[data-role="preview-button"] {
position: relative;
}
@@ -1577,7 +1723,8 @@ input[data-state="locked"] {
}
@media (prefers-reduced-motion: reduce) {
.button[data-role="preview-button"][data-loading="true"]::after {
.button[data-role="preview-button"][data-loading="true"]::after,
.spinner {
animation-duration: 1.6s;
}
}