Replace legacy branding with Kaizoku

This commit is contained in:
Codex
2026-08-09 13:42:51 +02:00
parent 95c9eca99f
commit fa7a922d13
15 changed files with 223 additions and 459 deletions
+12 -14
View File
@@ -24,9 +24,6 @@ import app_support
import provider_bridge
from app_support import (
AGENT,
ALLANIME_API,
ALLANIME_REFERER,
ALLMANGA_SITE_BASE,
ANIDB_ANIME_PAGE,
ANIDB_TITLES_CACHE,
ANIDB_TITLES_PATH,
@@ -37,6 +34,9 @@ from app_support import (
CONFIG_PATH,
DEFAULT_CONFIG,
MAX_JSON_BODY_BYTES,
METADATA_API,
METADATA_REFERER,
METADATA_SITE_BASE,
MODE_CHOICES,
QUALITY_CHOICES,
send_discord_webhook_event,
@@ -104,11 +104,11 @@ WATCHLIST_BACKUP_FORMAT_VERSION = 1
def graph_request(query, variables, timeout=25):
payload = json.dumps({"variables": variables, "query": query}).encode("utf-8")
request = urllib.request.Request(
f"{ALLANIME_API}/api",
f"{METADATA_API}/api",
data=payload,
headers={
"Content-Type": "application/json",
"Referer": ALLANIME_REFERER,
"Referer": METADATA_REFERER,
"User-Agent": AGENT,
},
method="POST",
@@ -117,17 +117,17 @@ def graph_request(query, variables, timeout=25):
with urllib.request.urlopen(request, timeout=timeout) as response:
raw = response.read().decode("utf-8")
except urllib.error.URLError as exc:
raise RuntimeError(f"Could not reach AllAnime: {exc}") from exc
raise RuntimeError(f"Could not reach metadata service: {exc}") from exc
except TimeoutError as exc:
raise RuntimeError("AllAnime request timed out") from exc
raise RuntimeError("Metadata request timed out") from exc
try:
data = json.loads(raw)
except json.JSONDecodeError as exc:
raise RuntimeError("AllAnime returned an unreadable response") from exc
raise RuntimeError("Metadata service returned an unreadable response") from exc
if data.get("errors"):
message = data["errors"][0].get("message", "AllAnime returned an error")
message = data["errors"][0].get("message", "Metadata service returned an error")
raise RuntimeError(message)
return data.get("data", {})
@@ -163,8 +163,8 @@ def search_thumbnail_cache_key(title):
def anime_source_url(show_id, title):
normalized_show_id = str(show_id or "").strip()
if not normalized_show_id:
return f"{ALLMANGA_SITE_BASE}/search-anime?tr=sub&cty=ALL&query={quote(str(title or '').strip(), safe='')}"
return f"{ALLMANGA_SITE_BASE}/bangumi/{quote(normalized_show_id, safe='')}"
return f"{METADATA_SITE_BASE}/search-anime?tr=sub&cty=ALL&query={quote(str(title or '').strip(), safe='')}"
return f"{METADATA_SITE_BASE}/bangumi/{quote(normalized_show_id, safe='')}"
def infer_image_extension(url, content_type):
@@ -2318,7 +2318,7 @@ class WatchlistStore:
def import_backup(self, backup):
if not isinstance(backup, dict):
raise ValueError("Watchlist backup must be a JSON object.")
if backup.get("format") not in {"kaizoku-watchlist-backup", "ani-cli-web-watchlist-backup"}:
if backup.get("format") != "kaizoku-watchlist-backup":
raise ValueError("Backup format is not recognized.")
try:
format_version = int(backup.get("format_version") or 0)
@@ -3120,8 +3120,6 @@ def save_runtime_config(config):
current = get_config_snapshot(fallback=DEFAULT_CONFIG)
merged = dict(current)
if isinstance(config, dict):
if "anipy_cli_fallback_enabled" in config and "download_methods" not in config:
merged.pop("download_methods", None)
merged.update(config)
normalized = normalize_config(merged)
previous_fingerprint = remote_access_session_fingerprint(current)