Add selectable animdl download fallback

This commit is contained in:
Dymas
2026-07-19 14:17:13 +02:00
parent 6bec0e068a
commit 6b3745c7e9
10 changed files with 282 additions and 65 deletions
+19
View File
@@ -20,6 +20,7 @@ from pathlib import Path
from urllib.parse import parse_qs, unquote, urlencode, urlparse, urlunparse
from app_support import (
ANIMDL,
ANI_CLI,
ANIPY_CLI,
APP_NAME,
@@ -94,6 +95,7 @@ def dependency_status():
result = {name: bool(shutil.which(name)) for name in checks}
result["ani-cli"] = cli_executable_exists(ANI_CLI)
result["anipy-cli"] = cli_executable_exists(ANIPY_CLI)
result["animdl"] = cli_executable_exists(ANIMDL)
return result
@@ -248,6 +250,22 @@ def installed_anipy_cli_version():
return version or "Unavailable"
@lru_cache(maxsize=1)
def installed_animdl_version():
try:
completed = subprocess.run(
[ANIMDL, "--version"],
check=True,
capture_output=True,
text=True,
timeout=6,
)
except (OSError, subprocess.SubprocessError):
return "Unavailable"
version = str(completed.stdout or completed.stderr or "").strip()
return version or "Unavailable"
class Handler(BaseHTTPRequestHandler):
server_version = "AniCliWeb/1.0"
remote_session_cookie_name = "ani_cli_web_session"
@@ -629,6 +647,7 @@ class Handler(BaseHTTPRequestHandler):
"version": VERSION,
"ani_cli_version": installed_ani_cli_version(),
"anipy_cli_version": installed_anipy_cli_version(),
"animdl_version": installed_animdl_version(),
}
)
elif parsed.path == "/api/changelog":