dates
This commit is contained in:
+21
-8
@@ -761,13 +761,9 @@ def _decide_movie_date(imdb_id: str, movie_dir: Path, poll_external: bool) -> Tu
|
||||
_log("INFO", f"Using Radarr import history date: {iso} for movie_id {movie_id} (IMDb: {imdb_id})")
|
||||
return iso, "radarr:history.import"
|
||||
|
||||
# Fallback to moviefile dateAdded
|
||||
iso2 = _radarr_earliest_file_dateadded_iso(movie_id)
|
||||
if iso2:
|
||||
_log("INFO", f"Using Radarr moviefile dateAdded: {iso2} for movie_id {movie_id}")
|
||||
return iso2, "radarr:moviefile.dateAdded"
|
||||
|
||||
_log("WARNING", f"No import dates found for movie_id {movie_id}")
|
||||
# If no real import events found, return None to continue to digital/cinema dates
|
||||
# instead of falling back to arbitrary moviefile.dateAdded
|
||||
_log("DEBUG", f"No real import events found for movie_id {movie_id}, will try digital/cinema dates")
|
||||
return None, "radarr:history.none"
|
||||
|
||||
def from_radarr_field(which: str) -> Tuple[Optional[str], str]:
|
||||
@@ -784,6 +780,17 @@ def _decide_movie_date(imdb_id: str, movie_dir: Path, poll_external: bool) -> Tu
|
||||
picked = _pick_earliest(cands)
|
||||
return picked if picked else (None, "digital:none")
|
||||
|
||||
def from_moviefile_dateadded() -> Tuple[Optional[str], str]:
|
||||
"""Last resort fallback for existing files that were just renamed/scanned"""
|
||||
ensure_movie()
|
||||
if not movie_id:
|
||||
return None, "radarr:moviefile.not_found"
|
||||
iso = _radarr_earliest_file_dateadded_iso(movie_id)
|
||||
if iso:
|
||||
_log("INFO", f"Using Radarr moviefile dateAdded as fallback: {iso} for movie_id {movie_id}")
|
||||
return iso, "radarr:moviefile.dateAdded"
|
||||
return None, "radarr:moviefile.none"
|
||||
|
||||
def maybe_sanitize_digital(digi_iso: Optional[str]) -> Tuple[Optional[str], str]:
|
||||
if not digi_iso or not config.movie_digital_sanity_check:
|
||||
return digi_iso, "radarr:digitalRelease"
|
||||
@@ -843,7 +850,13 @@ def _decide_movie_date(imdb_id: str, movie_dir: Path, poll_external: bool) -> Tu
|
||||
_log("INFO", f"Selected cinema date: {cine_iso} ({cine_src})")
|
||||
return cine_iso, cine_src, released_iso or cine_iso
|
||||
|
||||
_log("DEBUG", "No external dates found, falling back to file mtime")
|
||||
_log("DEBUG", "No external dates found, trying moviefile dateAdded as fallback")
|
||||
moviefile_iso, moviefile_src = from_moviefile_dateadded()
|
||||
if moviefile_iso:
|
||||
_log("WARNING", f"Using moviefile dateAdded for existing/renamed file: {moviefile_iso} ({moviefile_src})")
|
||||
return moviefile_iso, moviefile_src, released_iso
|
||||
|
||||
_log("DEBUG", "No moviefile date found, falling back to file mtime")
|
||||
mtime_iso, mtime_src = from_file_mtime()
|
||||
if mtime_iso:
|
||||
_log("WARNING", f"Using file mtime as last resort: {mtime_iso} ({mtime_src})")
|
||||
|
||||
Reference in New Issue
Block a user