diff --git a/VERSION b/VERSION index 0bfbd57..fe4e75f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.8.2 \ No newline at end of file +1.8.3 \ No newline at end of file diff --git a/nfoguard.py b/nfoguard.py index d255908..f29275c 100644 --- a/nfoguard.py +++ b/nfoguard.py @@ -1623,7 +1623,7 @@ class WebhookBatcher: if media_type == 'movie': expected_imdb = key.replace('movie:', '') if key.startswith('movie:') else key # Use comprehensive IMDb detection (directory, filenames, NFO content) - detected_imdb = self.nfo_manager.find_movie_imdb_id(path) + detected_imdb = self.nfo_manager.find_movie_imdb_id(path_obj) # Check if detected IMDb matches expected (handle both full IMDb IDs and just numbers) imdb_match = False @@ -1834,9 +1834,18 @@ async def radarr_webhook(request: Request, background_tasks: BackgroundTasks): _log("ERROR", f"This prevents processing wrong movies due to path mapping issues") return {"status": "error", "message": f"Mapped movie path does not exist: {container_path}"} - # Verify the path contains the expected IMDb ID - if imdb_id not in container_path.lower(): - _log("WARNING", f"IMDb ID {imdb_id} not found in container path {container_path}") + # Verify the path contains the expected IMDb ID using comprehensive detection + detected_imdb = nfo_manager.find_movie_imdb_id(Path(container_path)) + imdb_match = False + if detected_imdb: + if detected_imdb == imdb_id or detected_imdb.replace('tt', '') == imdb_id.replace('tt', ''): + imdb_match = True + + if not imdb_match: + _log("WARNING", f"IMDb ID {imdb_id} not found via comprehensive detection in {container_path}") + _log("DEBUG", f"Detected IMDb: {detected_imdb}, Expected: {imdb_id}") + else: + _log("DEBUG", f"IMDb ID validated: {imdb_id} matches detected {detected_imdb}") # Create movie-specific webhook data with proper path validation movie_webhook_data = {