api update
This commit is contained in:
@@ -184,9 +184,10 @@ class RadarrClient:
|
||||
_log("INFO", f"Finding earliest import for movie_id {movie_id}")
|
||||
|
||||
# Get movie info for path validation
|
||||
movie_info = self._get("/api/v3/movie", {"movieId": movie_id})
|
||||
if isinstance(movie_info, list) and movie_info:
|
||||
movie_info = movie_info[0]
|
||||
movie_info = self._get(f"/api/v3/movie/{movie_id}")
|
||||
if not movie_info or not isinstance(movie_info, dict):
|
||||
_log("ERROR", f"Could not get movie info for ID {movie_id}")
|
||||
return None
|
||||
|
||||
earliest_real_import = None
|
||||
first_grab = None
|
||||
|
||||
+18
-1
@@ -4,6 +4,7 @@ Path mapping module for NFOGuard
|
||||
Handles path translation between container, Radarr/Sonarr, and download client paths
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
@@ -165,10 +166,14 @@ class PathMapper:
|
||||
path_lower = str(path).lower()
|
||||
return any(indicator in path_lower for indicator in self.download_path_indicators)
|
||||
|
||||
def analyze_import_source_path(self, source_path: str) -> Tuple[bool, str]:
|
||||
def analyze_import_source_path(self, source_path: str, movie_path: str = None) -> Tuple[bool, str]:
|
||||
"""
|
||||
Analyze import source path to determine if it's from downloads.
|
||||
|
||||
Args:
|
||||
source_path: Path to analyze
|
||||
movie_path: Optional movie path to validate against
|
||||
|
||||
Returns:
|
||||
(is_from_downloads, reason)
|
||||
"""
|
||||
@@ -177,6 +182,18 @@ class PathMapper:
|
||||
|
||||
path_lower = source_path.lower()
|
||||
|
||||
# If movie_path is provided, check if source path has matching IMDb ID or movie name
|
||||
if movie_path:
|
||||
movie_lower = str(movie_path).lower()
|
||||
movie_basename = os.path.basename(movie_lower)
|
||||
source_basename = os.path.basename(path_lower)
|
||||
|
||||
# Extract IMDb ID pattern
|
||||
imdb_match = re.search(r'tt\d+', movie_basename)
|
||||
if imdb_match and imdb_match.group(0) in source_basename:
|
||||
_log("DEBUG", f"Source path matches movie IMDb ID: {imdb_match.group(0)}")
|
||||
return True, "matched_movie_imdb"
|
||||
|
||||
# Check for download indicators
|
||||
for indicator in self.download_path_indicators:
|
||||
if indicator in path_lower:
|
||||
|
||||
Reference in New Issue
Block a user