aboutsummaryrefslogtreecommitdiff
path: root/app/backends/audiocpp.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-25 18:10:08 -0400
committerhistoria <historiavg@proton.me>2026-08-25 18:10:08 -0400
commit4b49797b4d57c2d2cf63472636622a7a6280a38e (patch)
treee3687c734de5d6159cdad288e025057ed6cd3a16 /app/backends/audiocpp.py
parentbcac6c42eaf9e004716d72960bddefb1db68a93c (diff)
downloadtts-audiobook-generator-4b49797b4d57c2d2cf63472636622a7a6280a38e.tar.gz
feat: no console drop when uninstalling backends
Diffstat (limited to 'app/backends/audiocpp.py')
-rwxr-xr-xapp/backends/audiocpp.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/app/backends/audiocpp.py b/app/backends/audiocpp.py
index 0feb480..31aa01d 100755
--- a/app/backends/audiocpp.py
+++ b/app/backends/audiocpp.py
@@ -1650,16 +1650,25 @@ def delete_model_files(server_json: Path, entries: List[dict]) -> int:
return removed
-def uninstall() -> int:
+def uninstall(*, emit=None, cancel=None) -> int:
"""Remove the audio.cpp backend entirely: stop its server, delete the checkout.
The checkout (``app/audio.cpp``, or wherever ``find_local_checkout``
resolves it) holds the built binary, the downloaded models, and the
server.json, so removing the directory uninstalls the backend. A running
- server this tool started is stopped first (best-effort). Returns the exit
- code.
+ server this tool started is stopped first (best-effort).
+
+ EMIT is accepted for registry symmetry with the other backends but is
+ unused here — this uninstall has no subprocess phase, and its prints are
+ captured by the task view when run in the TUI. CANCEL is a
+ ``threading.Event`` honored between phases only (after the server has
+ been stopped, before the checkout is deleted), so a started phase always
+ completes and the uninstall never tears halfway. Returns the exit code
+ (130 when cancelled before a remaining phase).
"""
servers.stop("audiocpp")
+ if common.cancel_requested(cancel):
+ return 130
checkout = find_local_checkout()
if checkout is None:
print("[INFO] No audio.cpp checkout to remove.")