diff options
Diffstat (limited to 'audiobook.py')
| -rwxr-xr-x | audiobook.py | 11 |
1 files changed, 9 insertions, 2 deletions
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 |
