e741e4b046
- Add prefixed batch keys (movie:imdbid, tv:imdbid) to prevent IMDb ID collisions - Add path existence validation for Radarr webhooks to reject invalid mappings early - Remove duplicate Radarr webhook handler code - Add debug scripts for troubleshooting webhook and path mapping issues - Create corrected .env template with fixed TV_PATHS and SONARR_ROOT_FOLDERS This fixes the issue where TV path mapping failures caused movie webhooks to process wrong movies due to shared batch queue corruption.
81 lines
3.3 KiB
Python
81 lines
3.3 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Debug path mapping configuration
|
|
"""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
def check_path_mapping():
|
|
"""Check the current path mapping configuration"""
|
|
print("🔍 Path Mapping Configuration Debug")
|
|
print("=" * 50)
|
|
|
|
# Check environment variables
|
|
movie_paths = os.environ.get("MOVIE_PATHS", "NOT SET")
|
|
radarr_paths = os.environ.get("RADARR_ROOT_FOLDERS", "NOT SET")
|
|
|
|
print(f"MOVIE_PATHS: {movie_paths}")
|
|
print(f"RADARR_ROOT_FOLDERS: {radarr_paths}")
|
|
print()
|
|
|
|
# Parse paths
|
|
if movie_paths != "NOT SET":
|
|
container_paths = [p.strip() for p in movie_paths.split(",") if p.strip()]
|
|
print("Container paths:")
|
|
for i, path in enumerate(container_paths):
|
|
exists = Path(path).exists()
|
|
print(f" {i+1}. {path} {'✅' if exists else '❌ (does not exist)'}")
|
|
|
|
if radarr_paths != "NOT SET":
|
|
radarr_root_paths = [p.strip() for p in radarr_paths.split(",") if p.strip()]
|
|
print("\nRadarr root paths:")
|
|
for i, path in enumerate(radarr_root_paths):
|
|
print(f" {i+1}. {path}")
|
|
|
|
print("\n🔍 Expected Path Mappings:")
|
|
if movie_paths != "NOT SET" and radarr_paths != "NOT SET":
|
|
container_list = [p.strip() for p in movie_paths.split(",") if p.strip()]
|
|
radarr_list = [p.strip() for p in radarr_paths.split(",") if p.strip()]
|
|
|
|
for i, container_path in enumerate(container_list):
|
|
if i < len(radarr_list):
|
|
radarr_path = radarr_list[i]
|
|
print(f" {radarr_path} → {container_path}")
|
|
else:
|
|
print(f" ❌ No Radarr mapping for {container_path}")
|
|
|
|
print("\n🧪 Test Case:")
|
|
test_radarr_path = "/mnt/unionfs/Media/Movies/movies6/Annabelle Comes Home (2019) [tt8350360]"
|
|
print(f"Radarr path: {test_radarr_path}")
|
|
|
|
# Simulate mapping
|
|
if radarr_paths != "NOT SET" and movie_paths != "NOT SET":
|
|
container_list = [p.strip() for p in movie_paths.split(",") if p.strip()]
|
|
radarr_list = [p.strip() for p in radarr_paths.split(",") if p.strip()]
|
|
|
|
for i, radarr_root in enumerate(radarr_list):
|
|
if test_radarr_path.startswith(radarr_root):
|
|
container_root = container_list[i] if i < len(container_list) else container_list[0]
|
|
relative_path = test_radarr_path[len(radarr_root):].lstrip("/")
|
|
mapped_path = f"{container_root.rstrip('/')}/{relative_path}" if relative_path else container_root.rstrip("/")
|
|
print(f"Expected mapping: {mapped_path}")
|
|
|
|
# Check if mapped path exists
|
|
if Path(mapped_path).exists():
|
|
print("✅ Mapped path exists!")
|
|
else:
|
|
print("❌ Mapped path does not exist!")
|
|
print(f" This could be why the wrong movie is being processed.")
|
|
break
|
|
else:
|
|
print("❌ No mapping found for test path")
|
|
|
|
print("\n🛠️ Recommended Fix:")
|
|
print("Make sure your MOVIE_PATHS and RADARR_ROOT_FOLDERS match exactly:")
|
|
print("Example:")
|
|
print(" MOVIE_PATHS=/media/Movies/movies,/media/Movies/movies6")
|
|
print(" RADARR_ROOT_FOLDERS=/mnt/unionfs/Media/Movies/movies,/mnt/unionfs/Media/Movies/movies6")
|
|
|
|
if __name__ == "__main__":
|
|
check_path_mapping() |