sonarr-matching #48
@@ -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]}")
|
||||
|
||||
Reference in New Issue
Block a user