diff options
Diffstat (limited to 'app/backends/faster.py')
| -rwxr-xr-x | app/backends/faster.py | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/app/backends/faster.py b/app/backends/faster.py index 7ac4dce..50cf61f 100755 --- a/app/backends/faster.py +++ b/app/backends/faster.py @@ -289,12 +289,17 @@ def _wizard(stdscr, args: argparse.Namespace) -> Optional[dict]: return _after_whisper() def _after_whisper(): - # Default into the cloned checkout; fall back to the wav directory - # when the checkout is not present (so a flag-only run still works). + # Default into the cloned checkout — also when the clone is still + # pending in this run's steps (do_clone): detect() and the server + # launch only read voices.json from there, so a fresh install must + # not leave the file in the wav directory. The wav-directory + # fallback keeps flag-only runs working without any checkout. s["output_path"] = args.output if s["output_path"] is None: - s["output_path"] = (_checkout() / "voices.json") if _is_cloned() \ - else (s["wav_dir"] / "voices.json") + if _is_cloned() or s.get("do_clone"): + s["output_path"] = _checkout() / "voices.json" + else: + s["output_path"] = s["wav_dir"] / "voices.json" wav_files = find_wav_files(s["wav_dir"]) if wav_files and s["existing_voices"] and not args.force: return screen_transcription @@ -488,15 +493,23 @@ def _collect_from_flags(args: argparse.Namespace, language = normalize_language(args.language or config.LANGUAGE) except ValueError as exc: parser.error(str(exc)) - output_path = args.output if args.output is not None \ - else ((_checkout() / "voices.json") if _is_cloned() - else (wav_dir / "voices.json")) + do_install = (not _is_installed()) and not args.skip_install + do_clone = (not _is_cloned()) and not args.skip_clone + # The checkout's voices.json is the canonical location (detect() and + # the server launch read it there) — including when this run clones + # the checkout itself. Without a checkout, fall back to the wav dir. + output_path = args.output + if output_path is None: + if _is_cloned() or do_clone: + output_path = _checkout() / "voices.json" + else: + output_path = wav_dir / "voices.json" if output_path.exists() and not args.force: print("[INFO] Aborted; existing voices.json kept") return None return { - "do_install": (not _is_installed()) and not args.skip_install, - "do_clone": (not _is_cloned()) and not args.skip_clone, + "do_install": do_install, + "do_clone": do_clone, "wav_dir": wav_dir, "language": language, "whisper_model": args.whisper_model or "base", @@ -606,7 +619,11 @@ def uninstall(*, emit=None, cancel=None) -> int: killed mid-run. Returns the exit code (130 when cancelled before a remaining phase). """ - servers.stop("faster") + # Only stop when a pid file exists: without one this tool never + # started the server, so the "not started by this tool" notice would + # be uninstall-time noise. + if servers.pid_for("faster") is not None: + servers.stop("faster") if common.cancel_requested(cancel): return 130 rc = common.pip_uninstall(["faster-qwen3-tts"], emit=emit) @@ -622,7 +639,7 @@ def uninstall(*, emit=None, cancel=None) -> int: print(f"[INFO] Removing checkout {checkout}...") shutil.rmtree(checkout, ignore_errors=True) print("[OK] checkout removed.") - return 0 + return rc def main() -> int: |
