db: updates
Local Docker Build (Dev) / build-dev (push) Successful in 5s
Local Docker Build (Main) / build (pull_request) Successful in 8s
Local Docker Build (Main) / deploy (pull_request) Has been skipped

This commit is contained in:
2025-10-27 09:53:40 -04:00
parent 03bcd44565
commit 8dbc140b97
3 changed files with 54 additions and 6 deletions
+13 -1
View File
@@ -50,7 +50,7 @@ class NFOManager:
return None
def parse_imdb_from_path_with_nfo_fallback(self, path: Path, sonarr_client=None) -> Optional[str]:
def parse_imdb_from_path_with_nfo_fallback(self, path: Path, sonarr_client=None, shutdown_event=None) -> Optional[str]:
"""
Enhanced IMDb detection that fallback to Sonarr ID lookup from NFO files
@@ -63,6 +63,10 @@ class NFOManager:
if imdb_id:
return imdb_id
# Check for shutdown signal before expensive operations
if shutdown_event and shutdown_event.is_set():
return None
# Fallback: Check NFO files for Sonarr series ID
if not sonarr_client or not sonarr_client.enabled:
return None
@@ -79,6 +83,10 @@ class NFOManager:
# Extract Sonarr series ID from any NFO file
for nfo_file in nfo_files:
# Check for shutdown signal during NFO processing
if shutdown_event and shutdown_event.is_set():
return None
try:
tree = ET.parse(nfo_file)
root = tree.getroot()
@@ -87,6 +95,10 @@ class NFOManager:
for uniqueid in root.findall('.//uniqueid[@type="sonarr"]'):
sonarr_id = uniqueid.text
if sonarr_id and sonarr_id.isdigit():
# Check for shutdown signal before API call
if shutdown_event and shutdown_event.is_set():
return None
# Look up series in Sonarr to get IMDb ID
series_data = sonarr_client.get_series_by_id(int(sonarr_id))
if series_data: