aboutsummaryrefslogtreecommitdiff
path: root/app/backends/audiocpp/configsync.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-09-01 14:32:05 -0400
committerhistoria <historiavg@proton.me>2026-09-01 14:32:05 -0400
commit6cfcd564c0684c52618235e6366f4a81c02b9a5b (patch)
tree55321760a8103bc6b5d79489fac4135a60e6e3ba /app/backends/audiocpp/configsync.py
parentdc6e7cd43029da62dabe2513fb5aa8a34df1bd6d (diff)
downloadtts-audiobook-generator-6cfcd564c0684c52618235e6366f4a81c02b9a5b.tar.gz
slop refactor/dedup
Diffstat (limited to 'app/backends/audiocpp/configsync.py')
-rw-r--r--app/backends/audiocpp/configsync.py17
1 files changed, 1 insertions, 16 deletions
diff --git a/app/backends/audiocpp/configsync.py b/app/backends/audiocpp/configsync.py
index bce8142..0a0e5ad 100644
--- a/app/backends/audiocpp/configsync.py
+++ b/app/backends/audiocpp/configsync.py
@@ -14,10 +14,7 @@ from .constants import FALLBACK_PORT
def config_port() -> int:
"""Return the port of AUDIOCPP_API_URL in app/converter/config.py."""
- try:
- return urllib.parse.urlsplit(config.AUDIOCPP_API_URL).port or FALLBACK_PORT
- except ValueError:
- return FALLBACK_PORT
+ return common.port_of(config.AUDIOCPP_API_URL, FALLBACK_PORT)
def update_config_api_url_port(port: int, config_path: Optional[Path] = None) -> bool:
@@ -75,18 +72,6 @@ def update_server_config_port(port: int) -> bool:
return True
-def _apply_port_sync(port: int, accepted: bool) -> None:
- """Write the port into app/converter/config.py, or report when declined."""
- if accepted:
- if not update_config_api_url_port(port):
- print(f"[WARNING] Could not update {CONFIG_PATH}; edit "
- "AUDIOCPP_API_URL by hand so audiobook.py uses the "
- "new port")
- else:
- print("[WARNING] Left AUDIOCPP_API_URL unchanged; audiobook.py "
- f"will still use port {config_port()}")
-
-
def update_server_backend(backend: str) -> bool:
"""Rewrite the 'backend' in the checkout's server.json, or True when none.