update to docker

This commit is contained in:
2025-09-17 15:23:29 -04:00
parent d64228cc82
commit 532ea02a5b
4 changed files with 103 additions and 27 deletions
+13 -5
View File
@@ -14,14 +14,18 @@ from urllib.error import URLError, HTTPError
from core.logging import _log
def _get_json(url: str, timeout: int = 20, headers: Dict[str, str] = None) -> Optional[Dict[str, Any]]:
def _get_json(url: str, timeout: int = 20, headers: Dict[str, str] = None, suppress_404: bool = False) -> Optional[Dict[str, Any]]:
"""Make GET request and return JSON"""
try:
req = UrlRequest(url, headers=headers or {"Accept": "application/json"})
with urlopen(req, timeout=timeout) as resp:
return json.loads(resp.read().decode("utf-8"))
except Exception as e:
_log("WARNING", f"GET {url} failed: {e}")
# Handle HTTP 400/404 errors more gracefully for APIs where missing data is normal
if suppress_404 and ("400" in str(e) or "404" in str(e)):
_log("DEBUG", f"GET {url} - item not found (expected): {e}")
else:
_log("WARNING", f"GET {url} failed: {e}")
return None
@@ -83,16 +87,20 @@ class TVDBClient:
url = f"{self.base_url}/search/remoteid?remoteId={imdb_id}&type=series"
headers = {"Authorization": f"Bearer {token}"}
data = _get_json(url, headers=headers)
data = _get_json(url, headers=headers, suppress_404=True)
if data and data.get("status") == "success" and data.get("data"):
series_list = data["data"]
if series_list and len(series_list) > 0:
tvdb_id = series_list[0].get("id")
if tvdb_id:
_log("INFO", f"TVDB: Converted {imdb_id}{tvdb_id}")
_log("INFO", f"TVDB: Found series {imdb_id}{tvdb_id}")
return str(tvdb_id)
# If we get here, the series wasn't found in TVDB (common for newer shows)
_log("DEBUG", f"TVDB: No series found for IMDb {imdb_id} (not available in TVDB)")
except Exception as e:
_log("WARNING", f"TVDB IMDB conversion failed for {imdb_id}: {e}")
_log("WARNING", f"TVDB API error for {imdb_id}: {e}")
return None