aboutsummaryrefslogtreecommitdiff
path: root/app/backends/__init__.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/__init__.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/__init__.py')
-rw-r--r--app/backends/__init__.py37
1 files changed, 25 insertions, 12 deletions
diff --git a/app/backends/__init__.py b/app/backends/__init__.py
index 9facd13..9e8bf31 100644
--- a/app/backends/__init__.py
+++ b/app/backends/__init__.py
@@ -24,7 +24,7 @@ automatically.
import shlex
from dataclasses import dataclass, field
-from typing import Callable, List, Optional
+from typing import Callable, Dict, List, Optional
@dataclass
@@ -48,20 +48,30 @@ class BackendStatus:
INSTALLED means the backend itself is present (a cloned + built
checkout, or a pip package). CONFIGURED means the supporting files are
in place (a server.json / voices.json and an app/converter/config.py that
- points at the right port). RUNNING means an external server is
- currently accepting connections on the configured port (probed by
- ``backends.common.server_running``). DETAILS are short status lines for
- the hub. LAUNCH_HINT is the human-readable command(s) the user runs to
- start the server, derived from SERVERS by ``format_launch_hint``.
- SERVERS is the machine-usable list of server processes the hub can
- start/stop (empty when the backend is not yet configured).
+ points at the right port). DETAILS are short status lines for the hub.
+ LAUNCH_HINT is the human-readable command(s) the user runs to start the
+ server, derived from SERVERS by ``format_launch_hint``. SERVERS is the
+ machine-usable list of server processes the hub can start/stop (empty
+ when the backend is not yet configured).
MANAGED says a running server was started by this tool: ``servers``
contains a spec whose pid file still names a live process (see
- ``servers.manages``); when RUNNING but not MANAGED the hub tags the
- status "[remote]". RUNNING_MODELS names which of a multi-server
- backend's models answered (qwen: "Base" and/or "CustomVoice"), shown
- in parentheses in the hub's status table.
+ ``servers.manages``); when a server is running but not MANAGED the hub
+ tags it "[remote]".
+
+ REMOTE says a server answering at the backend's configured remote URL
+ (``*_REMOTE_URL`` in ``app/converter/config.py``) was identified as this
+ backend by ``backends.probe.identify_server`` — a server this tool did
+ not start (it is suppressed when the remote URL equals the local URL and
+ this tool's own pid is still alive). REMOTE_URLS maps each server spec
+ name ("audiocpp", "faster", "qwen-custom", "qwen-clone") to the remote
+ URL that answered, so the hub's convert menu can target it. RUNNING is
+ true when the backend is usable either locally (MANAGED) or remotely
+ (REMOTE), and drives both the status table ("running [local]",
+ "running [remote]", "running [local, remote]") and the hub menu gating.
+ RUNNING_MODELS names which of a multi-server backend's models answered
+ (qwen: "Base" and/or "CustomVoice", local and remote combined), shown in
+ parentheses in the hub's status table.
"""
key: str
label: str
@@ -73,6 +83,9 @@ class BackendStatus:
servers: List[ServerSpec] = field(default_factory=list)
managed: bool = False
running_models: List[str] = field(default_factory=list)
+ remote: bool = False
+ remote_urls: Dict[str, str] = field(default_factory=dict)
+ remote_models: List[str] = field(default_factory=list)
@property
def ready(self) -> bool: