update movie paths
This commit is contained in:
+20
-16
@@ -1474,22 +1474,26 @@ async def radarr_webhook(request: Request, background_tasks: BackgroundTasks):
|
||||
_log("WARNING", "No IMDb ID in Radarr webhook movie data")
|
||||
return {"status": "error", "message": "No IMDb ID"}
|
||||
|
||||
# Get movie path for verification
|
||||
movie_path = movie_data.get("path", "")
|
||||
if movie_path:
|
||||
container_path = path_mapper.radarr_path_to_container_path(movie_path)
|
||||
_log("DEBUG", f"Mapped Radarr path {movie_path} -> {container_path}")
|
||||
|
||||
# CRITICAL: Verify the mapped path actually exists
|
||||
from pathlib import Path
|
||||
if not Path(container_path).exists():
|
||||
_log("ERROR", f"RADARR WEBHOOK REJECTED: Mapped path does not exist: {container_path}")
|
||||
_log("ERROR", f"This prevents processing wrong movies due to path mapping issues")
|
||||
return {"status": "error", "message": f"Mapped movie path does not exist: {container_path}"}
|
||||
|
||||
# Verify the path contains the expected IMDb ID
|
||||
if imdb_id not in container_path.lower():
|
||||
_log("WARNING", f"IMDb ID {imdb_id} not found in container path {container_path}")
|
||||
# Get movie path and map it
|
||||
movie_path = movie_data.get("folderPath") or movie_data.get("path", "")
|
||||
if not movie_path:
|
||||
_log("ERROR", "No movie path in Radarr webhook")
|
||||
return {"status": "error", "message": "No movie path provided"}
|
||||
|
||||
# Map the path to container path
|
||||
container_path = path_mapper.radarr_path_to_container_path(movie_path)
|
||||
_log("DEBUG", f"Mapped Radarr path {movie_path} -> {container_path}")
|
||||
|
||||
# CRITICAL: Verify the mapped path actually exists
|
||||
from pathlib import Path
|
||||
if not Path(container_path).exists():
|
||||
_log("ERROR", f"RADARR WEBHOOK REJECTED: Mapped path does not exist: {container_path}")
|
||||
_log("ERROR", f"This prevents processing wrong movies due to path mapping issues")
|
||||
return {"status": "error", "message": f"Mapped movie path does not exist: {container_path}"}
|
||||
|
||||
# Verify the path contains the expected IMDb ID
|
||||
if imdb_id not in container_path.lower():
|
||||
_log("WARNING", f"IMDb ID {imdb_id} not found in container path {container_path}")
|
||||
|
||||
# Create movie-specific webhook data with proper path validation
|
||||
movie_webhook_data = {
|
||||
|
||||
Reference in New Issue
Block a user