diff options
Diffstat (limited to 'app/converter/clients/base.py')
| -rw-r--r-- | app/converter/clients/base.py | 9 |
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).""" |
