aboutsummaryrefslogtreecommitdiff
path: root/app/backends/faster.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-24 16:08:33 -0400
committerhistoria <historiavg@proton.me>2026-08-24 16:08:33 -0400
commit1ff9a635bd9b033b631a6b525891b7eb44e189d3 (patch)
tree6dbcd7e682d516770be4c0724db793666c93dd5f /app/backends/faster.py
parentafd1c67d92c7f32389d5f652b9fa71530538a16f (diff)
downloadtts-audiobook-generator-1ff9a635bd9b033b631a6b525891b7eb44e189d3.tar.gz
feat: clearer split between local (managed) and remote URLs and server status
Diffstat (limited to 'app/backends/faster.py')
-rwxr-xr-xapp/backends/faster.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/app/backends/faster.py b/app/backends/faster.py
index 77b9c8a..3dc30dd 100755
--- a/app/backends/faster.py
+++ b/app/backends/faster.py
@@ -31,6 +31,7 @@ from backends import (
common,
envs,
format_launch_hint,
+ probe,
servers,
)
from backends.common import (
@@ -348,7 +349,6 @@ def detect() -> BackendStatus:
cloned = _is_cloned()
voices_json = _checkout() / "voices.json"
configured = installed and cloned and voices_json.exists()
- running = common.server_running(config.FASTER_API_URL)
details: List[str] = []
details.append("pip: installed" if installed else
"not installed — run setup to pip install")
@@ -364,11 +364,31 @@ def detect() -> BackendStatus:
"--voices", str(voices_json), "--port", str(_config_port())]
specs = [ServerSpec("faster", config.FASTER_API_URL, argv)]
launch = format_launch_hint(specs)
+ managed = servers.manages(specs)
+ remote_running, remote_urls = _detect_remote(managed)
return BackendStatus("faster", "faster-qwen3-tts",
installed=installed and cloned,
- configured=configured, running=running,
+ configured=configured,
+ running=managed or remote_running,
details=details, launch_hint=launch,
- servers=specs, managed=servers.manages(specs))
+ servers=specs, managed=managed,
+ remote=remote_running, remote_urls=remote_urls)
+
+
+def _detect_remote(managed: bool = False):
+ """Detect an externally-run faster server at the remote URL.
+
+ Returns ``(running, {spec_name: url})``; see audiocpp._detect_remote for
+ the shared semantics (empty URL disables, own server not counted twice).
+ """
+ url = (config.FASTER_REMOTE_URL or "").strip()
+ if not url:
+ return False, {}
+ if managed and probe.same_endpoint(url, config.FASTER_API_URL):
+ return False, {}
+ if probe.identify_server(url) == probe.IDENTITY_FASTER:
+ return True, {"faster": url}
+ return False, {}
def _run_voices_only_tui() -> int: