diff options
| author | historia <historiavg@proton.me> | 2026-08-25 19:03:09 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-25 19:03:09 -0400 |
| commit | 8c9a782dfe94525dc5f0893c98fd19543648264b (patch) | |
| tree | fdff70d967ef06f0da560ca284842427cbe647a8 /app/backends/audiocpp.py | |
| parent | 64e9940d43fad1bc5908b39673b03e4fdc1e8f2f (diff) | |
| download | tts-audiobook-generator-8c9a782dfe94525dc5f0893c98fd19543648264b.tar.gz | |
fix: tui errors wait for getch()
Diffstat (limited to 'app/backends/audiocpp.py')
| -rwxr-xr-x | app/backends/audiocpp.py | 55 |
1 files changed, 21 insertions, 34 deletions
diff --git a/app/backends/audiocpp.py b/app/backends/audiocpp.py index 31aa01d..f6121ea 100755 --- a/app/backends/audiocpp.py +++ b/app/backends/audiocpp.py @@ -1987,39 +1987,28 @@ def _build_audiocpp_tui(emit, cancel, argv: List[str], command: str, return rc -def _print_launch_hint(audiocpp_dir: Path, output_path: Path, - pending_build: bool = False) -> None: - """Print the exact command to start the server (or build guidance). - - The command is prefixed with ``cd <checkout> &&`` because the server - discovers model_specs/<family>.json relative to its working directory. - PENDING_BUILD is True when the server is still building in a parallel - lane; instead of "build it first" remediation the hint then names the - command to run once that build finishes. +def _print_launch_hint(audiocpp_dir: Path, output_path: Path) -> None: + """Print remediation when audiocpp_server is missing (troubleshooting). + + The hub starts and stops the server itself, so a working install gets + no manual launch instructions. When no binary was built, though, the + user needs to know how to build and run it by hand. The commands are + prefixed with ``cd <checkout> &&`` because the server discovers + model_specs/<family>.json relative to its working directory. """ - binary = find_audiocpp_server_bin(audiocpp_dir) - print() - if binary is not None: - print("Start the server with:") - print(f" cd {audiocpp_dir} && {binary} --config {output_path}") - elif pending_build: - print("The server is still building in the other panel — once it " - "finishes, start it with:") - print(f" cd {audiocpp_dir} && ./build/<platform>-<backend>-release" - f"/bin/audiocpp_server --config {output_path}") - else: - print("[INFO] audiocpp_server binary not found. Build it first, e.g.:") - script = find_build_script(audiocpp_dir) - if script is not None: - print(f" sh {script} --backend <cuda|vulkan|hip|cpu> " - "--target audiocpp_server --deployment-build") - print(f" then run: cd {audiocpp_dir} && ./build/<platform>-<backend>" - f"-release/bin/audiocpp_server --config {output_path}") + if find_audiocpp_server_bin(audiocpp_dir) is not None: + return + print("\n[INFO] audiocpp_server binary not found. Build it first, e.g.:") + script = find_build_script(audiocpp_dir) + if script is not None: + print(f" sh {script} --backend <cuda|vulkan|hip|cpu> " + "--target audiocpp_server --deployment-build") + print(f" then run: cd {audiocpp_dir} && ./build/<platform>-<backend>" + f"-release/bin/audiocpp_server --config {output_path}") def _execute_lanes(settings: dict, - args: argparse.Namespace, - parallel: bool = False) -> List[taskview.TaskLane]: + args: argparse.Namespace) -> List[taskview.TaskLane]: """Build the ordered setup steps for the in-TUI task view, per lane. The same work ``_execute`` runs on the console, split into two lanes so @@ -2031,8 +2020,7 @@ def _execute_lanes(settings: dict, dict scoped to the models lane. Each step's ``work(emit, cancel)`` returns its exit code; subprocess steps stream through EMIT and abort on CANCEL, while print()-based steps are captured by the view's stdout - routing. PARALLEL marks the launch hint as concurrent-with-build so it - does not claim the binary is missing while the build is still running. + routing. """ audiocpp_dir = settings["audiocpp_dir"] state: dict = {} @@ -2102,8 +2090,7 @@ def _execute_lanes(settings: dict, def install(emit, cancel): _install_models(audiocpp_dir, settings["install_guidance"], settings["download"], emit=emit, cancel=cancel) - _print_launch_hint(audiocpp_dir, settings["output_path"], - pending_build=bool(build and parallel)) + _print_launch_hint(audiocpp_dir, settings["output_path"]) return 0 install_title = "Download models" if settings.get("download") \ else "Print model install commands" @@ -2163,7 +2150,7 @@ def setup_screen(stdscr) -> int: if settings is None: return 1 return taskview.run_lanes(stdscr, "Setting up audio.cpp", - _execute_lanes(settings, args, parallel=True)) + _execute_lanes(settings, args)) def build_screen(stdscr) -> int: |
