aboutsummaryrefslogtreecommitdiff
path: root/audiobook.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-30 18:49:32 -0400
committerhistoria <historiavg@proton.me>2026-08-30 18:49:32 -0400
commit93f106aac2d6411c80a911adac62cd12f80e58be (patch)
tree5db8a2ff27f0d06ef313b3cf9ab84bf02f74479f /audiobook.py
parentd31e9149c7f141b2d3c14a79e9f067d524c8c420 (diff)
downloadtts-audiobook-generator-93f106aac2d6411c80a911adac62cd12f80e58be.tar.gz
feat: output log path when audiobook generation fails
Diffstat (limited to 'audiobook.py')
-rwxr-xr-xaudiobook.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/audiobook.py b/audiobook.py
index 36fc2df..64ec0d6 100755
--- a/audiobook.py
+++ b/audiobook.py
@@ -80,6 +80,16 @@ def resolve_book_path(path: Path) -> Path:
return resolved if resolved.is_absolute() else _BASE_DIR / resolved
+def run_log_path() -> Path:
+ """The full path of this run's dated log file (app/logs/audiobook_*.log).
+
+ Pointed at from the console when a conversion run fails: the file
+ keeps the full record (the failure's traceback, per-chunk errors)
+ that the console summary only sketches.
+ """
+ return logging_kit.stream_path("audiobook", _converter_mod.LOGS_FOLDER)
+
+
def convert(backend: str, voice: str = None, clone: str = None,
transcription: str = None, no_transcription: bool = False,
language: str = None, speed: float = None, single_file: bool = False,
@@ -222,6 +232,10 @@ def convert(backend: str, voice: str = None, clone: str = None,
# Anything else is an actual crash, so also show the traceback.
logging_kit.log_traceback()
print(f"[FATAL] Fatal error: {exc}")
+ if progress is None:
+ # The run view owns the TUI console and points failures at the
+ # log itself (the error screen's details hint).
+ print(f"[INFO] Full details in the log file: {run_log_path()}")
if not isinstance(exc, (RuntimeError, ValueError)):
traceback.print_exc()
if progress is not None:
@@ -230,6 +244,10 @@ def convert(backend: str, voice: str = None, clone: str = None,
finally:
if server is not None:
server.shutdown()
+ if not ok and progress is None:
+ # The run failed (a book aborted the rest): the summary above only
+ # names the failed books, so point at the log with the details.
+ print(f"[INFO] Full details in the log file: {run_log_path()}")
return 0 if ok else 1