fix: tier levels not working as well as an option to ignore the .nfo file and query
Local Docker Build (Dev) / build-dev (push) Successful in 4s
Local Docker Build (Dev) / build-dev (push) Successful in 4s
This commit is contained in:
@@ -93,6 +93,11 @@ UPDATE_MODE=always
|
||||
# File modification time behavior (update, leave_alone)
|
||||
MTIME_BEHAVIOR=update
|
||||
|
||||
# Manual scan priority: use existing NFO dates for speed vs check APIs for accuracy
|
||||
# false (default) = Check external APIs first, use NFO as fallback (slower but accurate)
|
||||
# true = Use NFO dates immediately without API checks (faster but may use wrong dates)
|
||||
MANUAL_SCAN_PRIORITIZE_NFO=false
|
||||
|
||||
# ===========================================
|
||||
# PERFORMANCE & BATCHING
|
||||
# ===========================================
|
||||
|
||||
+5
-1
@@ -129,6 +129,9 @@ class NFOGuardConfig:
|
||||
self.prefer_release_dates_over_file_dates = _bool_env("PREFER_RELEASE_DATES_OVER_FILE_DATES", True)
|
||||
self.allow_file_date_fallback = _bool_env("ALLOW_FILE_DATE_FALLBACK", False)
|
||||
|
||||
# Manual scan behavior
|
||||
self.manual_scan_prioritize_nfo = _bool_env("MANUAL_SCAN_PRIORITIZE_NFO", False)
|
||||
|
||||
# Release date settings
|
||||
release_priority_env = os.environ.get("RELEASE_DATE_PRIORITY", "digital,physical,theatrical")
|
||||
self.release_date_priority = [p.strip() for p in release_priority_env.split(",") if p.strip()]
|
||||
@@ -238,7 +241,8 @@ class NFOGuardConfig:
|
||||
"manage_nfo": self.manage_nfo,
|
||||
"fix_dir_mtimes": self.fix_dir_mtimes,
|
||||
"lock_metadata": self.lock_metadata,
|
||||
"debug": self.debug
|
||||
"debug": self.debug,
|
||||
"manual_scan_prioritize_nfo": self.manual_scan_prioritize_nfo
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -743,8 +743,11 @@ class NFOManager:
|
||||
dt = datetime.fromisoformat(iso_timestamp.replace('Z', '+00:00'))
|
||||
elif '+' in iso_timestamp or 'T' in iso_timestamp:
|
||||
dt = datetime.fromisoformat(iso_timestamp)
|
||||
elif ' ' in iso_timestamp:
|
||||
# Handle space-separated datetime format (e.g., "2025-10-16 20:31:22")
|
||||
dt = datetime.fromisoformat(iso_timestamp.replace(' ', 'T'))
|
||||
else:
|
||||
# Assume it's already a simple date
|
||||
# Assume it's a simple date (e.g., "2025-10-16")
|
||||
dt = datetime.fromisoformat(iso_timestamp + 'T00:00:00')
|
||||
|
||||
# Convert to timestamp
|
||||
|
||||
@@ -172,9 +172,11 @@ class MovieProcessor:
|
||||
return
|
||||
|
||||
# TIER 2.5: Check for any existing valid date data in NFO (even without lockdata marker)
|
||||
# Only use NFO dates if prioritize_nfo is enabled, otherwise check external APIs first
|
||||
existing_nfo_data = self._extract_any_valid_dates_from_nfo(nfo_path)
|
||||
if existing_nfo_data:
|
||||
if existing_nfo_data and config.manual_scan_prioritize_nfo:
|
||||
_log("INFO", f"🔍 TIER 2.5 - Found existing date data in NFO (no lockdata): {existing_nfo_data['dateadded']} (source: {existing_nfo_data['source']})")
|
||||
_log("INFO", f"⚡ MANUAL_SCAN_PRIORITIZE_NFO=True - Using NFO date for speed")
|
||||
dateadded = existing_nfo_data["dateadded"]
|
||||
source = existing_nfo_data["source"]
|
||||
released = existing_nfo_data.get("released")
|
||||
@@ -197,6 +199,11 @@ class MovieProcessor:
|
||||
|
||||
_log("INFO", f"Completed processing movie: {movie_path.name} (source: {source}) [existing-nfo-enhanced]")
|
||||
return
|
||||
elif existing_nfo_data:
|
||||
_log("INFO", f"🔍 TIER 2.5 - Found existing date data in NFO (no lockdata): {existing_nfo_data['dateadded']} (source: {existing_nfo_data['source']})")
|
||||
_log("INFO", f"🎯 MANUAL_SCAN_PRIORITIZE_NFO=False - Will verify against external APIs first")
|
||||
# Store NFO data as fallback but continue to TIER 3 to check external APIs
|
||||
nfo_fallback_data = existing_nfo_data
|
||||
|
||||
# TIER 1.5: Special handling for TMDB-only movies - extract dates from existing NFO
|
||||
if is_tmdb_fallback:
|
||||
@@ -235,7 +242,9 @@ class MovieProcessor:
|
||||
_log("DEBUG", f"Movie {imdb_id}: should_query={should_query}, poll_mode={config.movie_poll_mode}")
|
||||
|
||||
# Use existing movie date decision logic
|
||||
dateadded, source, released = self._decide_movie_dates(imdb_id, movie_path, should_query, None)
|
||||
# Pass NFO fallback data if available for cases where external APIs don't have import history
|
||||
nfo_fallback = locals().get('nfo_fallback_data', None)
|
||||
dateadded, source, released = self._decide_movie_dates(imdb_id, movie_path, should_query, nfo_fallback)
|
||||
|
||||
# Webhook fallback: if ALL date sources fail, use current timestamp
|
||||
if webhook_mode and dateadded is None:
|
||||
@@ -465,6 +474,11 @@ class MovieProcessor:
|
||||
local_import_date = convert_utc_to_local(import_date)
|
||||
return local_import_date, import_source, released
|
||||
|
||||
# Last resort: check if we have NFO fallback data (when external APIs don't have import history)
|
||||
if existing and existing.get('dateadded'):
|
||||
_log("INFO", f"✅ Movie {imdb_id}: External APIs don't have import history, using NFO fallback date: {existing['dateadded']} (source: {existing['source']})")
|
||||
return existing["dateadded"], f"nfo_fallback:{existing['source']}", existing.get("released")
|
||||
|
||||
# Last resort: file mtime (if allowed)
|
||||
if config.allow_file_date_fallback:
|
||||
return self._get_file_mtime_date(movie_path)
|
||||
|
||||
Reference in New Issue
Block a user