aboutsummaryrefslogtreecommitdiff
path: root/app/backends/audiocpp/voices.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-26 17:46:48 -0400
committerhistoria <historiavg@proton.me>2026-08-26 17:46:48 -0400
commit6ccb6d443d2fb871b43d96ea61a95bc3e6a92355 (patch)
treed692ddccd6ec212cf4ebabb25a85e83af479d0fe /app/backends/audiocpp/voices.py
parentc147087c9d4707bffaeee58d390653637a21cce8 (diff)
downloadtts-audiobook-generator-6ccb6d443d2fb871b43d96ea61a95bc3e6a92355.tar.gz
feat: combined install/configure tui screens into one menu, removed extraneous wizard screens
Diffstat (limited to 'app/backends/audiocpp/voices.py')
-rw-r--r--app/backends/audiocpp/voices.py35
1 files changed, 3 insertions, 32 deletions
diff --git a/app/backends/audiocpp/voices.py b/app/backends/audiocpp/voices.py
index 2f0fdd7..b26a0be 100644
--- a/app/backends/audiocpp/voices.py
+++ b/app/backends/audiocpp/voices.py
@@ -2,7 +2,7 @@
import argparse
from pathlib import Path
-from typing import Callable, Dict, List, Optional, Tuple
+from typing import Dict, List, Optional, Tuple
from backends.common import (PROMPT_TEXT_FILENAME, find_wav_files,
read_prompt_text)
@@ -53,43 +53,14 @@ def print_empty_transcript_warning(transcripts: Dict[str, str]) -> None:
print(bar)
-def _decide_transcription(wav_files: list, existing: Dict[str, str],
- prompt_exists: bool, force: bool,
- confirm: Callable[[str, bool], bool]) -> dict:
- """Decide which voices to transcribe; CONFIRM asks the plan questions.
-
- Returns a plan dict: {"mode": "all"|"missing"|"keep", "missing":
- [...], "existing": {...}} — "existing" carries the prompt_text
- mapping read while deciding, so the caller can reuse it instead of
- reading the file again.
- """
- mode = "all"
- missing: List[Path] = []
- if prompt_exists and not force:
- missing = [wav for wav in wav_files
- if not existing.get(wav.stem, "").strip()]
- if not missing:
- if confirm("All voices already transcribed in prompt_text. "
- "Re-transcribe anyway?", False):
- mode = "all"
- else:
- mode = "keep"
- elif confirm("Existing transcription and new .wavs detected, "
- "only transcribe new voices?", True):
- mode = "missing"
- else:
- mode = "all"
- return {"mode": mode, "missing": missing, "existing": existing}
-
-
def _transcribe(args: argparse.Namespace, plan: Optional[dict],
cancel=None) -> Tuple[Dict[str, str], bool]:
"""Transcribe the wav directory into a stem -> transcript mapping.
Returns the mapping and a flag indicating whether it should be written to
prompt_text (False when an existing, complete prompt_text is kept as-is).
- PLAN is always pre-collected — by the TUI (via _decide_transcription and
- its confirm callbacks) or by _flag_plan for a non-interactive run — so no
+ PLAN is always pre-collected — by the TUI setup form (mode "all",
+ "missing" or "keep") or by _flag_plan for a non-interactive run — so no
questions are asked here; a None PLAN defaults to "transcribe everything".
CANCEL is checked between files.
"""