fix: Use comprehensive IMDb detection for movie batch validation
Local Docker Build (Dev) / build-dev (push) Successful in 33s
Local Docker Build (Dev) / build-dev (push) Successful in 33s
- Replace simple string search with find_movie_imdb_id() method - Check directory name, filenames, and NFO file content for IMDb ID - Handle both full IMDb IDs (tt26394837) and number formats - Add detailed logging for detected vs expected IMDb matching - Fix validation failures when IMDb ID is in filename/NFO but not directory name Resolves movie webhook processing failures when directory lacks IMDb ID but files contain proper identification.
This commit is contained in:
+14
-2
@@ -1621,11 +1621,23 @@ class WebhookBatcher:
|
||||
# CRITICAL: Validate that the path contains the expected IMDb ID for movies
|
||||
if media_type == 'movie':
|
||||
expected_imdb = key.replace('movie:', '') if key.startswith('movie:') else key
|
||||
if expected_imdb not in path_str.lower():
|
||||
# Use comprehensive IMDb detection (directory, filenames, NFO content)
|
||||
detected_imdb = self.nfo_manager.find_movie_imdb_id(path)
|
||||
|
||||
# Check if detected IMDb matches expected (handle both full IMDb IDs and just numbers)
|
||||
imdb_match = False
|
||||
if detected_imdb:
|
||||
if detected_imdb == expected_imdb:
|
||||
imdb_match = True
|
||||
elif detected_imdb.replace('tt', '') == expected_imdb.replace('tt', ''):
|
||||
imdb_match = True
|
||||
|
||||
if not imdb_match:
|
||||
_log("ERROR", f"BATCH VALIDATION FAILED: Expected IMDb {expected_imdb} not found in path {path_str}")
|
||||
_log("ERROR", f"Detected IMDb: {detected_imdb}, Expected: {expected_imdb}")
|
||||
_log("ERROR", f"This prevents processing wrong movies due to batch corruption")
|
||||
return
|
||||
_log("DEBUG", f"Batch validation passed: IMDb {expected_imdb} found in path")
|
||||
_log("DEBUG", f"Batch validation passed: Expected IMDb {expected_imdb} matches detected IMDb {detected_imdb}")
|
||||
|
||||
# Process based on media type
|
||||
if media_type == 'tv':
|
||||
|
||||
Reference in New Issue
Block a user