aboutsummaryrefslogtreecommitdiff
path: root/app/converter/clients/base.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-09-01 14:32:05 -0400
committerhistoria <historiavg@proton.me>2026-09-01 14:32:05 -0400
commit6cfcd564c0684c52618235e6366f4a81c02b9a5b (patch)
tree55321760a8103bc6b5d79489fac4135a60e6e3ba /app/converter/clients/base.py
parentdc6e7cd43029da62dabe2513fb5aa8a34df1bd6d (diff)
downloadtts-audiobook-generator-6cfcd564c0684c52618235e6366f4a81c02b9a5b.tar.gz
slop refactor/dedup
Diffstat (limited to 'app/converter/clients/base.py')
-rw-r--r--app/converter/clients/base.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/converter/clients/base.py b/app/converter/clients/base.py
index 8a0b4e4..9cf6979 100644
--- a/app/converter/clients/base.py
+++ b/app/converter/clients/base.py
@@ -68,14 +68,17 @@ class BaseTTSClient:
cancel = None
quiet = False
- def __init__(self, chunks_dir: Path, quiet: bool = False):
+ def __init__(self, chunks_dir: Path, quiet: bool = False,
+ cancel: Optional[threading.Event] = None):
self.chunks_dir = Path(chunks_dir)
# Quiet silences console prints (the run view owns the screen).
self.quiet = bool(quiet)
# Set by the converter when the run is cancellable (the TUI run
# view): a threading.Event that, once set, aborts the run between
- # requests (and interrupts retry back-off sleeps).
- self.cancel = None
+ # requests (and interrupts retry back-off sleeps). Assigned here —
+ # before the subclass's connect logic runs — so a cancel pressed
+ # while the client is still connecting is not lost.
+ self.cancel = cancel
def _report(self, message: str) -> None:
"""Print a console line unless quiet (the run view owns the screen)."""