Clean up retired metadata path
This commit is contained in:
@@ -35,8 +35,6 @@ from app_support import (
|
||||
CONFIG_PATH,
|
||||
DEFAULT_CONFIG,
|
||||
MAX_JSON_BODY_BYTES,
|
||||
METADATA_API,
|
||||
METADATA_REFERER,
|
||||
MODE_CHOICES,
|
||||
QUALITY_CHOICES,
|
||||
send_discord_webhook_event,
|
||||
@@ -101,37 +99,6 @@ WATCHLIST_JELLYFIN_SYNC = None
|
||||
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"{METADATA_API}/api",
|
||||
data=payload,
|
||||
headers={
|
||||
"Content-Type": "application/json",
|
||||
"Referer": METADATA_REFERER,
|
||||
"User-Agent": AGENT,
|
||||
},
|
||||
method="POST",
|
||||
)
|
||||
try:
|
||||
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 metadata service: {exc}") from exc
|
||||
except TimeoutError as exc:
|
||||
raise RuntimeError("Metadata request timed out") from exc
|
||||
|
||||
try:
|
||||
data = json.loads(raw)
|
||||
except json.JSONDecodeError as exc:
|
||||
raise RuntimeError("Metadata service returned an unreadable response") from exc
|
||||
|
||||
if data.get("errors"):
|
||||
message = data["errors"][0].get("message", "Metadata service returned an error")
|
||||
raise RuntimeError(message)
|
||||
return data.get("data", {})
|
||||
|
||||
|
||||
def parse_iso_timestamp(value):
|
||||
text = str(value or "").strip()
|
||||
if not text:
|
||||
@@ -2209,8 +2176,8 @@ class WatchlistStore:
|
||||
if include_thumbnail and self.has_show(normalized_show_id):
|
||||
try:
|
||||
self.ensure_thumbnail(normalized_show_id)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as exc:
|
||||
debug_log("watchlist.refresh.thumbnail_failed", show_id=normalized_show_id, error=exc)
|
||||
item = self.get(normalized_show_id)
|
||||
item["previous_sub_count"] = previous_sub_count
|
||||
item["previous_dub_count"] = previous_dub_count
|
||||
@@ -2802,8 +2769,8 @@ class WatchlistStore:
|
||||
continue
|
||||
try:
|
||||
self.ensure_thumbnail(show_id, force=force)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as exc:
|
||||
debug_log("watchlist.ensure_thumbnails.failed", show_id=show_id, error=exc)
|
||||
try:
|
||||
updated.append(self.get(show_id))
|
||||
except KeyError:
|
||||
|
||||
Reference in New Issue
Block a user