From 6cfcd564c0684c52618235e6366f4a81c02b9a5b Mon Sep 17 00:00:00 2001 From: historia Date: Tue, 1 Sep 2026 14:32:05 -0400 Subject: slop refactor/dedup --- audiobook.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'audiobook.py') diff --git a/audiobook.py b/audiobook.py index 183bdc2..b881b6e 100755 --- a/audiobook.py +++ b/audiobook.py @@ -209,8 +209,15 @@ def _convert_each_model(*, backend: str, model_ids: list, model_voices: dict, converter._book_files = book_files converter._planned = planned ok = converter.run() - model_ok = counts["ok"] if progress is not None \ - else (len(planned) if ok else 0) + if progress is not None: + model_ok = counts["ok"] + else: + # A failed book aborts the rest, but the books that + # succeeded before it still count (run() returns False + # for the whole model either way). + model_ok = sum( + 1 for success in getattr(converter, "results", {}).values() + if success) except KeyboardInterrupt: print("\n[WARNING] Shutdown requested by user") return 130 -- cgit v1.2.3