This commit is contained in:
@@ -7,11 +7,13 @@ Phase 4: Replace NFO-based initial population with direct DB/API queries
|
||||
import time
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
from core.database import NFOGuardDatabase
|
||||
from clients.radarr_client import RadarrClient
|
||||
from clients.sonarr_client import SonarrClient
|
||||
from utils.logging import _log
|
||||
from utils.imdb_utils import parse_imdb_from_path
|
||||
|
||||
|
||||
class DatabasePopulator:
|
||||
@@ -66,9 +68,20 @@ class DatabasePopulator:
|
||||
# Process each movie
|
||||
for movie in movies:
|
||||
try:
|
||||
# Get movie path first (we'll need it for IMDb extraction)
|
||||
path = movie.get('path', '')
|
||||
|
||||
# Try to get IMDb ID from Radarr database
|
||||
imdb_id = movie.get('imdbId')
|
||||
|
||||
# If not in database, try extracting from directory/filename
|
||||
if not imdb_id and path:
|
||||
imdb_id = parse_imdb_from_path(Path(path))
|
||||
if imdb_id:
|
||||
_log("DEBUG", f"Extracted IMDb ID {imdb_id} from path for: {movie.get('title')}")
|
||||
|
||||
if not imdb_id:
|
||||
_log("DEBUG", f"Skipping movie without IMDb ID: {movie.get('title')}")
|
||||
_log("DEBUG", f"Skipping movie without IMDb ID: {movie.get('title')} (path: {path})")
|
||||
stats['skipped'] += 1
|
||||
continue
|
||||
|
||||
@@ -79,9 +92,6 @@ class DatabasePopulator:
|
||||
stats['skipped'] += 1
|
||||
continue
|
||||
|
||||
# Get movie path
|
||||
path = movie.get('path', '')
|
||||
|
||||
# Get release date
|
||||
released = None
|
||||
if movie.get('digitalRelease'):
|
||||
|
||||
Reference in New Issue
Block a user