From 60bbf9440ae78fd244f4a6da87add951d1ad0074 Mon Sep 17 00:00:00 2001 From: sbcrumb Date: Sun, 12 Oct 2025 10:51:52 -0400 Subject: [PATCH 1/3] 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 From a0f676a36887468c70f85f0f43596f4afdf01776 Mon Sep 17 00:00:00 2001 From: sbcrumb Date: Sun, 12 Oct 2025 10:52:48 -0400 Subject: [PATCH 2/3] chore: Bump version to 2.0.25 for sonarr-matching fixes - Increment version for comprehensive TV IMDb detection fixes - Includes glob pattern fix and batch validation improvements - Ready for deployment and testing --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 8f4c02d..efb4534 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.24 +2.0.25 From 7216491d763b26be52e5ff179657b80270bdaf64 Mon Sep 17 00:00:00 2001 From: sbcrumb Date: Sun, 12 Oct 2025 11:01:59 -0400 Subject: [PATCH 3/3] debug: Add comprehensive webhook path mapping debug logging - Track webhook path provided from Sonarr webhooks - Show path mapper availability and mapping results - Trace why webhook paths fail and fallback to search occurs - Version 2.0.27 for webhook path debugging --- VERSION | 2 +- utils/file_utils.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index f6ee962..2ce4589 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.26 +2.0.27 diff --git a/utils/file_utils.py b/utils/file_utils.py index 0b1e1b3..74c95df 100644 --- a/utils/file_utils.py +++ b/utils/file_utils.py @@ -40,20 +40,35 @@ def find_media_path_by_imdb_and_title( Path to media directory if found, None otherwise """ # 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: try: if hasattr(path_mapper, 'sonarr_path_to_container_path'): container_path = path_mapper.sonarr_path_to_container_path(webhook_path) + print(f"🔍 Sonarr path mapped: {webhook_path} → {container_path}") elif hasattr(path_mapper, 'radarr_path_to_container_path'): container_path = path_mapper.radarr_path_to_container_path(webhook_path) + print(f"🔍 Radarr path mapped: {webhook_path} → {container_path}") else: container_path = webhook_path + print(f"🔍 No mapper, using direct path: {container_path}") path_obj = Path(container_path) + print(f"🔍 Mapped path exists: {path_obj.exists()} - {path_obj}") if path_obj.exists(): + print(f"✅ Using webhook path: {path_obj}") return path_obj + else: + print(f"❌ Webhook path doesn't exist, falling back to search") 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}") + 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 print(f"🔍 Total search paths to check: {len(search_paths)} - {[str(p) for p in search_paths]}")