diff --git a/VERSION b/VERSION index fc5237e..46c5dc5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.8.6-sql-fix +2.8.7-imdb-path-extraction diff --git a/core/database_populator.py b/core/database_populator.py index 4ccad35..11304b5 100644 --- a/core/database_populator.py +++ b/core/database_populator.py @@ -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'): diff --git a/nfoguard-web/main_web.py b/nfoguard-web/main_web.py index 02af1fc..451e0d2 100644 --- a/nfoguard-web/main_web.py +++ b/nfoguard-web/main_web.py @@ -33,7 +33,7 @@ def create_web_app() -> FastAPI: app = FastAPI( title="NFOGuard Web Interface", description="Web interface for NFOGuard media database management", - version="2.8.6-sql-fix", + version="2.8.7-imdb-path-extraction", docs_url="/docs" if web_config.web_debug else None, redoc_url="/redoc" if web_config.web_debug else None ) diff --git a/start_web.py b/start_web.py index 47ff620..4bcac15 100644 --- a/start_web.py +++ b/start_web.py @@ -29,7 +29,7 @@ def create_web_app() -> FastAPI: app = FastAPI( title="NFOGuard Web Interface", description="Web interface for NFOGuard media database management", - version="2.8.6-sql-fix", + version="2.8.7-imdb-path-extraction", docs_url=None, # Disable docs in production redoc_url=None ) @@ -94,7 +94,7 @@ def setup_static_files(app: FastAPI) -> None: "status": "healthy", "service": "nfoguard-web", "timestamp": time.time(), - "version": "2.8.6-sql-fix" + "version": "2.8.7-imdb-path-extraction" } except Exception as e: from fastapi import HTTPException