Add anipy-cli download fallback

Add an optional config toggle that retries failed ani-cli downloads with anipy-cli, expose fallback runtime status in the config page, and update release docs and tests for the new behavior.
This commit is contained in:
Dymas
2026-07-09 14:11:40 +02:00
parent 332ec670fc
commit d8ed64bd64
8 changed files with 319 additions and 61 deletions
+23
View File
@@ -461,6 +461,7 @@ CONFIG_HTML = r"""<!doctype html>
<div class="stack muted">
<p id="versionLine">Loading version...</p>
<p id="aniCliVersionLine">Detecting ani-cli version...</p>
<p id="anipyCliVersionLine">Detecting anipy-cli fallback...</p>
<p>Saved settings live in `.ani-cli-web/config.json` inside this project.</p>
</div>
<button class="ghost wide-button" id="openChangelogBtn" type="button">Changelog</button>
@@ -506,6 +507,24 @@ CONFIG_HTML = r"""<!doctype html>
<div class="field-hint">Tip: these are the saved defaults only. The active search form can still be adjusted per download.</div>
</section>
<section class="settings settings-main">
<div class="toolbar">
<div>
<h2>Download fallback</h2>
<p class="muted">If a queued `ani-cli` download fails, optionally retry it once with `anipy-cli`.</p>
</div>
</div>
<div class="form-grid">
<label>Automatic retry with anipy-cli
<select id="anipyCliFallbackEnabled">
<option value="false">Disabled</option>
<option value="true">Enabled</option>
</select>
</label>
</div>
<div class="field-hint">This only kicks in after an `ani-cli` failure. Install `anipy-cli` separately and keep it in `PATH` if you enable this option.</div>
</section>
<section class="settings settings-main">
<div class="toolbar">
<div>
@@ -666,6 +685,7 @@ CONFIG_HTML = r"""<!doctype html>
mode: "sub",
quality: "best",
download_dir: "",
anipy_cli_fallback_enabled: false,
watchlist_auto_refresh_enabled: false,
watchlist_auto_refresh_minutes: 60,
watchlist_refresh_delay_seconds: 5,
@@ -732,6 +752,7 @@ CONFIG_HTML = r"""<!doctype html>
download_dir: $("downloadDir").value,
mode: $("configMode").value,
quality: $("configQuality").value,
anipy_cli_fallback_enabled: $("anipyCliFallbackEnabled").value === "true",
watchlist_auto_refresh_enabled: $("watchlistAutoRefreshEnabled").value === "true",
watchlist_auto_refresh_minutes: $("watchlistAutoRefreshMinutes").value,
watchlist_refresh_delay_seconds: $("watchlistRefreshDelaySeconds").value,
@@ -751,6 +772,7 @@ CONFIG_HTML = r"""<!doctype html>
$("downloadDir").value = data.download_dir;
$("configMode").value = data.mode;
$("configQuality").value = data.quality;
$("anipyCliFallbackEnabled").value = String(Boolean(data.anipy_cli_fallback_enabled));
$("watchlistAutoRefreshEnabled").value = String(Boolean(data.watchlist_auto_refresh_enabled));
$("watchlistAutoRefreshMinutes").value = data.watchlist_auto_refresh_minutes;
$("watchlistRefreshDelaySeconds").value = data.watchlist_refresh_delay_seconds;
@@ -960,6 +982,7 @@ CONFIG_HTML = r"""<!doctype html>
const data = await api("/api/version");
$("versionLine").textContent = `${data.name} ${data.version}`;
$("aniCliVersionLine").textContent = `ani-cli ${data.ani_cli_version || "Unavailable"}`;
$("anipyCliVersionLine").textContent = `anipy-cli ${data.anipy_cli_version || "Unavailable"}`;
}
async function openChangelog() {