release: Clean up debug logging and bump to v2.1.0
Local Docker Build (Dev) / build-dev (push) Successful in 4s
Local Docker Build (Dev) / build-dev (push) Successful in 4s
FEATURES ADDED: - Comprehensive TV IMDb detection (folder/filename/NFO) - TV show batch validation prevents wrong series processing - Fixed glob pattern for exact IMDb matching - Enhanced webhook path mapping reliability CLEANUP: - Removed temporary debug print statements - Clean production-ready logging - Maintains all core improvements from debugging session FIXES: - Resolves Girls (2012) vs Golden Girls matching issue - Proper bracket escaping in glob patterns - Comprehensive IMDb detection for both movies and TV shows
This commit is contained in:
@@ -97,12 +97,9 @@ class NFOManager:
|
|||||||
|
|
||||||
def find_movie_imdb_id(self, movie_dir: Path) -> Optional[str]:
|
def find_movie_imdb_id(self, movie_dir: Path) -> Optional[str]:
|
||||||
"""Find IMDb ID from directory name, filenames, or NFO file"""
|
"""Find IMDb ID from directory name, filenames, or NFO file"""
|
||||||
print(f"🔍 Searching for IMDb ID in: {movie_dir.name}")
|
|
||||||
|
|
||||||
# First try directory name
|
# First try directory name
|
||||||
imdb_id = self.parse_imdb_from_path(movie_dir)
|
imdb_id = self.parse_imdb_from_path(movie_dir)
|
||||||
if imdb_id:
|
if imdb_id:
|
||||||
print(f"✅ Found IMDb ID in directory name: {imdb_id}")
|
|
||||||
return imdb_id
|
return imdb_id
|
||||||
|
|
||||||
# Try all files in the directory for IMDb ID patterns
|
# Try all files in the directory for IMDb ID patterns
|
||||||
@@ -110,30 +107,21 @@ class NFOManager:
|
|||||||
if file_path.is_file():
|
if file_path.is_file():
|
||||||
imdb_id = self.parse_imdb_from_path(file_path)
|
imdb_id = self.parse_imdb_from_path(file_path)
|
||||||
if imdb_id:
|
if imdb_id:
|
||||||
print(f"✅ Found IMDb ID in filename: {imdb_id} from {file_path.name}")
|
|
||||||
return imdb_id
|
return imdb_id
|
||||||
|
|
||||||
# Finally, try NFO file content (including TMDB fallback)
|
# Finally, try NFO file content (including TMDB fallback)
|
||||||
nfo_path = movie_dir / "movie.nfo"
|
nfo_path = movie_dir / "movie.nfo"
|
||||||
imdb_id = self.parse_imdb_from_nfo(nfo_path)
|
imdb_id = self.parse_imdb_from_nfo(nfo_path)
|
||||||
if imdb_id:
|
if imdb_id:
|
||||||
if imdb_id.startswith("tmdb-"):
|
|
||||||
print(f"✅ Found TMDB ID in NFO file: {imdb_id} from {nfo_path} (fallback mode)")
|
|
||||||
else:
|
|
||||||
print(f"✅ Found IMDb ID in NFO file: {imdb_id} from {nfo_path}")
|
|
||||||
return imdb_id
|
return imdb_id
|
||||||
|
|
||||||
print(f"❌ No IMDb or TMDB ID found in directory, filenames, or NFO for: {movie_dir.name}")
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def find_series_imdb_id(self, series_dir: Path) -> Optional[str]:
|
def find_series_imdb_id(self, series_dir: Path) -> Optional[str]:
|
||||||
"""Find IMDb ID from TV series directory name, filenames, or tvshow.nfo file"""
|
"""Find IMDb ID from TV series directory name, filenames, or tvshow.nfo file"""
|
||||||
print(f"🔍 Searching for IMDb ID in TV series: {series_dir.name}")
|
|
||||||
|
|
||||||
# First try directory name
|
# First try directory name
|
||||||
imdb_id = self.parse_imdb_from_path(series_dir)
|
imdb_id = self.parse_imdb_from_path(series_dir)
|
||||||
if imdb_id:
|
if imdb_id:
|
||||||
print(f"✅ Found IMDb ID in series directory name: {imdb_id}")
|
|
||||||
return imdb_id
|
return imdb_id
|
||||||
|
|
||||||
# Try all files in the directory for IMDb ID patterns
|
# Try all files in the directory for IMDb ID patterns
|
||||||
@@ -141,20 +129,14 @@ class NFOManager:
|
|||||||
if file_path.is_file():
|
if file_path.is_file():
|
||||||
imdb_id = self.parse_imdb_from_path(file_path)
|
imdb_id = self.parse_imdb_from_path(file_path)
|
||||||
if imdb_id:
|
if imdb_id:
|
||||||
print(f"✅ Found IMDb ID in series filename: {imdb_id} from {file_path.name}")
|
|
||||||
return imdb_id
|
return imdb_id
|
||||||
|
|
||||||
# Finally, try tvshow.nfo file content
|
# Finally, try tvshow.nfo file content
|
||||||
nfo_path = series_dir / "tvshow.nfo"
|
nfo_path = series_dir / "tvshow.nfo"
|
||||||
imdb_id = self.parse_imdb_from_nfo(nfo_path)
|
imdb_id = self.parse_imdb_from_nfo(nfo_path)
|
||||||
if imdb_id:
|
if imdb_id:
|
||||||
if imdb_id.startswith("tmdb-"):
|
|
||||||
print(f"✅ Found TMDB ID in tvshow.nfo: {imdb_id} from {nfo_path} (fallback mode)")
|
|
||||||
else:
|
|
||||||
print(f"✅ Found IMDb ID in tvshow.nfo: {imdb_id} from {nfo_path}")
|
|
||||||
return imdb_id
|
return imdb_id
|
||||||
|
|
||||||
print(f"❌ No IMDb or TMDB ID found in series directory, filenames, or tvshow.nfo for: {series_dir.name}")
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def extract_nfoguard_dates_from_nfo(self, nfo_path: Path) -> Optional[Dict[str, str]]:
|
def extract_nfoguard_dates_from_nfo(self, nfo_path: Path) -> Optional[Dict[str, str]]:
|
||||||
|
|||||||
@@ -40,69 +40,41 @@ def find_media_path_by_imdb_and_title(
|
|||||||
Path to media directory if found, None otherwise
|
Path to media directory if found, None otherwise
|
||||||
"""
|
"""
|
||||||
# Try webhook path first if provided
|
# Try webhook path first if provided
|
||||||
print(f"🔍 Webhook path provided: {webhook_path}")
|
|
||||||
print(f"🔍 Path mapper available: {path_mapper is not None}")
|
|
||||||
if webhook_path and path_mapper:
|
if webhook_path and path_mapper:
|
||||||
try:
|
try:
|
||||||
if hasattr(path_mapper, 'sonarr_path_to_container_path'):
|
if hasattr(path_mapper, 'sonarr_path_to_container_path'):
|
||||||
# Force debug mode for path mapping
|
|
||||||
old_debug = getattr(path_mapper, 'path_debug', False)
|
|
||||||
path_mapper.path_debug = True
|
|
||||||
container_path = path_mapper.sonarr_path_to_container_path(webhook_path)
|
container_path = path_mapper.sonarr_path_to_container_path(webhook_path)
|
||||||
path_mapper.path_debug = old_debug
|
|
||||||
print(f"🔍 Sonarr path mapped: {webhook_path} → {container_path}")
|
|
||||||
elif hasattr(path_mapper, 'radarr_path_to_container_path'):
|
elif hasattr(path_mapper, 'radarr_path_to_container_path'):
|
||||||
container_path = path_mapper.radarr_path_to_container_path(webhook_path)
|
container_path = path_mapper.radarr_path_to_container_path(webhook_path)
|
||||||
print(f"🔍 Radarr path mapped: {webhook_path} → {container_path}")
|
|
||||||
else:
|
else:
|
||||||
container_path = webhook_path
|
container_path = webhook_path
|
||||||
print(f"🔍 No mapper, using direct path: {container_path}")
|
|
||||||
|
|
||||||
path_obj = Path(container_path)
|
path_obj = Path(container_path)
|
||||||
print(f"🔍 Mapped path exists: {path_obj.exists()} - {path_obj}")
|
|
||||||
if path_obj.exists():
|
if path_obj.exists():
|
||||||
print(f"✅ Using webhook path: {path_obj}")
|
|
||||||
return path_obj
|
return path_obj
|
||||||
else:
|
|
||||||
print(f"❌ Webhook path doesn't exist, falling back to search")
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"❌ Failed to process webhook path {webhook_path}: {e}")
|
|
||||||
_log("WARNING", f"Failed to process webhook path {webhook_path}: {e}")
|
_log("WARNING", f"Failed to process webhook path {webhook_path}: {e}")
|
||||||
else:
|
|
||||||
if not webhook_path:
|
|
||||||
print(f"❌ No webhook path provided")
|
|
||||||
if not path_mapper:
|
|
||||||
print(f"❌ No path mapper available")
|
|
||||||
|
|
||||||
# Search by IMDb ID or title in configured paths
|
# Search by IMDb ID or title in configured paths
|
||||||
print(f"🔍 Total search paths to check: {len(search_paths)} - {[str(p) for p in search_paths]}")
|
|
||||||
for media_path in search_paths:
|
for media_path in search_paths:
|
||||||
print(f"🔍 Checking path: {media_path} (exists: {media_path.exists()})")
|
|
||||||
if not media_path.exists():
|
if not media_path.exists():
|
||||||
print(f"❌ Skipping non-existent path: {media_path}")
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Search by IMDb ID first (more reliable)
|
# Search by IMDb ID first (more reliable)
|
||||||
if imdb_id:
|
if imdb_id:
|
||||||
# Use proper glob pattern - escape brackets to match literal [imdb-ID]
|
# Use proper glob pattern - escape brackets to match literal [imdb-ID]
|
||||||
pattern = str(media_path / f"*\\[imdb-{imdb_id}\\]*")
|
pattern = str(media_path / f"*\\[imdb-{imdb_id}\\]*")
|
||||||
print(f"🔍 Searching with pattern: {pattern}")
|
|
||||||
matches = glob.glob(pattern)
|
matches = glob.glob(pattern)
|
||||||
print(f"🔍 Pattern matches found: {len(matches)} - {matches[:3] if matches else 'None'}")
|
|
||||||
if matches:
|
if matches:
|
||||||
print(f"✅ Returning first match: {matches[0]}")
|
|
||||||
return Path(matches[0])
|
return Path(matches[0])
|
||||||
|
|
||||||
# Search by title as fallback
|
# Search by title as fallback
|
||||||
if title:
|
if title:
|
||||||
title_clean = clean_title_for_search(title)
|
title_clean = clean_title_for_search(title)
|
||||||
print(f"🔍 Title fallback: searching for '{title}' → cleaned: '{title_clean}'")
|
|
||||||
for item in media_path.iterdir():
|
for item in media_path.iterdir():
|
||||||
if item.is_dir() and "[imdb-" in item.name.lower():
|
if item.is_dir() and "[imdb-" in item.name.lower():
|
||||||
item_clean = clean_title_for_search(item.name)
|
item_clean = clean_title_for_search(item.name)
|
||||||
print(f"🔍 Checking directory: '{item.name}' → cleaned: '{item_clean}'")
|
|
||||||
if title_clean in item_clean:
|
if title_clean in item_clean:
|
||||||
print(f"✅ Title match found: '{title_clean}' in '{item_clean}' → returning {item}")
|
|
||||||
return item
|
return item
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|||||||
Reference in New Issue
Block a user