diff options
Diffstat (limited to 'audiobook.py')
| -rwxr-xr-x | audiobook.py | 18 |
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 |
