From 60bbf9440ae78fd244f4a6da87add951d1ad0074 Mon Sep 17 00:00:00 2001 From: sbcrumb Date: Sun, 12 Oct 2025 10:51:52 -0400 Subject: [PATCH] debug: Add logging to find_media_path_by_imdb_and_title to trace search behavior - Add debug prints to see glob patterns being used - Track number of matches found and which paths are returned - Help diagnose why wrong TV series paths are still being found --- utils/file_utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/file_utils.py b/utils/file_utils.py index 8bce466..cc2e1d5 100644 --- a/utils/file_utils.py +++ b/utils/file_utils.py @@ -64,8 +64,11 @@ def find_media_path_by_imdb_and_title( if imdb_id: # Use proper glob pattern - escape brackets to match literal [imdb-ID] pattern = str(media_path / f"*\\[imdb-{imdb_id}\\]*") + print(f"🔍 Searching with pattern: {pattern}") matches = glob.glob(pattern) + print(f"🔍 Pattern matches found: {len(matches)} - {matches[:3] if matches else 'None'}") if matches: + print(f"✅ Returning first match: {matches[0]}") return Path(matches[0]) # Search by title as fallback