aboutsummaryrefslogtreecommitdiff
path: root/app/backends/audiocpp/build.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-28 18:44:32 -0400
committerhistoria <historiavg@proton.me>2026-08-28 18:44:32 -0400
commit03ed68bafec56ef8bb690440d796c1a742042907 (patch)
tree9f80e1848ca8c141f49875ffdbe462527ab0a9c3 /app/backends/audiocpp/build.py
parent3c9b7e12029f6accdaabb6f60e01bce88156db98 (diff)
downloadtts-audiobook-generator-03ed68bafec56ef8bb690440d796c1a742042907.tar.gz
feat(audio.cpp): if github binary download fails, automatically start building from source
Diffstat (limited to 'app/backends/audiocpp/build.py')
-rw-r--r--app/backends/audiocpp/build.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/app/backends/audiocpp/build.py b/app/backends/audiocpp/build.py
index f840193..e3536cf 100644
--- a/app/backends/audiocpp/build.py
+++ b/app/backends/audiocpp/build.py
@@ -138,22 +138,26 @@ def _update_prebuilt(checkout: Path, backend: Optional[str], *,
"""The update route for a prebuilt (release-downloaded) install.
Source builds update by rebuilding after a git pull; a prebuilt
- install instead re-downloads when upstream published a newer release
- (the marker's tag is compared against the latest release tag). The
- recorded/detected backend selects the asset, mirroring what was
- originally installed. A GitHub outage is not fatal — the installed
- binary keeps working. Returns the install exit code (0 when already
- current or when the check could not run).
+ install instead re-downloads when upstream published a newer release.
+ The current-version check resolves the newest tag from the release
+ page's redirect (no API quota); the API is only consulted by the
+ re-download itself, for the checksum digests. The recorded/detected
+ backend selects the asset, mirroring what was originally installed.
+ A GitHub outage is not fatal — the installed binary keeps working.
+ Returns the install exit code (0 when already current or when the
+ check could not run).
"""
marker = _prebuilt.installed_release(checkout, backend)
- release = _prebuilt.fetch_latest_release()
- if release is None:
+ tag = _prebuilt.resolve_latest_tag()
+ if tag is None:
+ release = _prebuilt.fetch_latest_release()
+ tag = str(release.get("tag_name") or "") if release else ""
+ if not tag:
print("[WARNING] Could not check GitHub for a newer prebuilt "
"audiocpp_server; keeping the installed one ("
f"{marker.get('tag') if marker else 'unknown'}).")
return 0
- tag = str(release.get("tag_name") or "")
- if marker and tag and tag == marker.get("tag"):
+ if marker and tag == marker.get("tag"):
print(f"[OK] Prebuilt audiocpp_server is current ({tag}).")
return 0
print(f"[INFO] audio.cpp {tag} is available; downloading the prebuilt "