fix file date release to option not required

This commit is contained in:
2025-09-09 10:03:54 -04:00
parent 0aa9655d25
commit b2938758e2
4 changed files with 38 additions and 4 deletions
+4
View File
@@ -82,6 +82,10 @@ MOVIE_PRIORITY=import_then_digital
# Smart fallback: prefer release dates over file dates for manual imports (true/false) # Smart fallback: prefer release dates over file dates for manual imports (true/false)
PREFER_RELEASE_DATES_OVER_FILE_DATES=true PREFER_RELEASE_DATES_OVER_FILE_DATES=true
# Allow file dates as absolute last resort (true/false)
# If false, movies with no valid import AND no release dates will be skipped entirely
ALLOW_FILE_DATE_FALLBACK=false
# Fallback priority order when no valid Radarr import exists (comma-separated) # Fallback priority order when no valid Radarr import exists (comma-separated)
# Options: digital, physical, theatrical # Options: digital, physical, theatrical
# digital = VOD/streaming release, physical = DVD/Blu-ray, theatrical = cinema release # digital = VOD/streaming release, physical = DVD/Blu-ray, theatrical = cinema release
+4
View File
@@ -13,6 +13,10 @@ All notable changes to this project will be documented in this file.
- **Smart Comparison Logic**: Prevents unrealistic dates (won't use 2000 digital for 1983 movie) - **Smart Comparison Logic**: Prevents unrealistic dates (won't use 2000 digital for 1983 movie)
- **Per-Movie Intelligence**: "The Craft (1996)" gets 1996 theatrical, "Top Gun Maverick (2022)" gets digital - **Per-Movie Intelligence**: "The Craft (1996)" gets 1996 theatrical, "Top Gun Maverick (2022)" gets digital
- **Configuration**: `PREFER_RELEASE_DATES_OVER_FILE_DATES=true` replaces old digital-only setting - **Configuration**: `PREFER_RELEASE_DATES_OVER_FILE_DATES=true` replaces old digital-only setting
- **🔇 File Date Fallback Control**: New option to completely disable file date usage
- **Configuration**: `ALLOW_FILE_DATE_FALLBACK=false` (default: false)
- **Behavior**: Movies with no release dates get skipped instead of using file dates
- **Clean Logs**: Eliminates "Using file dateAdded as fallback" warnings
- **Enhanced Debug Endpoints**: - **Enhanced Debug Endpoints**:
- `/debug/movie/{imdb_id}/priority` - Shows date selection logic and available sources - `/debug/movie/{imdb_id}/priority` - Shows date selection logic and available sources
- Detailed analysis of file date vs digital date decisions - Detailed analysis of file date vs digital date decisions
+15
View File
@@ -292,6 +292,21 @@ RELEASE_DATE_PRIORITY=physical,digital,theatrical
RELEASE_DATE_PRIORITY=digital,theatrical,physical RELEASE_DATE_PRIORITY=digital,theatrical,physical
``` ```
### Disabling File Date Fallbacks
**Problem**: Don't want file modification dates used at all
**Solution**: Disable file date fallbacks completely
```bash
# Add to your .env
ALLOW_FILE_DATE_FALLBACK=false
```
**Result**:
- ✅ Movies with release dates get processed normally
- ⚠️ Movies with NO release dates get skipped (no NFO created)
- 🔇 No more "Using file dateAdded as fallback" warnings
## 📖 Example Workflow ## 📖 Example Workflow
You add The Blacklist in Sonarr. You add The Blacklist in Sonarr.
+14 -3
View File
@@ -97,6 +97,7 @@ class NFOGuardConfig:
# Movie processing # Movie processing
self.movie_priority = os.environ.get("MOVIE_PRIORITY", "import_then_digital").lower() self.movie_priority = os.environ.get("MOVIE_PRIORITY", "import_then_digital").lower()
self.prefer_release_dates_over_file_dates = _bool_env("PREFER_RELEASE_DATES_OVER_FILE_DATES", True) 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)
self.release_date_priority = [p.strip() for p in os.environ.get("RELEASE_DATE_PRIORITY", "digital,physical,theatrical").split(",")] self.release_date_priority = [p.strip() for p in os.environ.get("RELEASE_DATE_PRIORITY", "digital,physical,theatrical").split(",")]
self.movie_poll_mode = os.environ.get("MOVIE_POLL_MODE", "always").lower() self.movie_poll_mode = os.environ.get("MOVIE_POLL_MODE", "always").lower()
self.movie_update_mode = os.environ.get("MOVIE_DATE_UPDATE_MODE", "backfill_only").lower() self.movie_update_mode = os.environ.get("MOVIE_DATE_UPDATE_MODE", "backfill_only").lower()
@@ -431,6 +432,12 @@ class MovieProcessor:
# Decide dates # Decide dates
dateadded, source, released = self._decide_movie_dates(imdb_id, movie_path, should_query, existing) dateadded, source, released = self._decide_movie_dates(imdb_id, movie_path, should_query, existing)
# Skip processing if no valid date found and file dates disabled
if dateadded is None:
_log("WARNING", f"Skipping movie {movie_path.name} - no valid date source available")
self.db.upsert_movie_dates(imdb_id, released, None, source, True)
return
# Create NFO # Create NFO
if config.manage_nfo: if config.manage_nfo:
self.nfo_manager.create_movie_nfo( self.nfo_manager.create_movie_nfo(
@@ -466,7 +473,7 @@ class MovieProcessor:
if radarr_movie: if radarr_movie:
movie_id = radarr_movie.get("id") movie_id = radarr_movie.get("id")
if movie_id: if movie_id:
import_date, import_source = self.radarr.get_movie_import_date(movie_id) import_date, import_source = self.radarr.get_movie_import_date(movie_id, fallback_to_file_date=config.allow_file_date_fallback)
# Check if we got a real import date or just file date fallback # Check if we got a real import date or just file date fallback
if import_date and import_source != "radarr:db.file.dateAdded": if import_date and import_source != "radarr:db.file.dateAdded":
@@ -499,12 +506,16 @@ class MovieProcessor:
if radarr_movie: if radarr_movie:
movie_id = radarr_movie.get("id") movie_id = radarr_movie.get("id")
if movie_id: if movie_id:
import_date, import_source = self.radarr.get_movie_import_date(movie_id) import_date, import_source = self.radarr.get_movie_import_date(movie_id, fallback_to_file_date=config.allow_file_date_fallback)
if import_date: if import_date:
return import_date, import_source, released return import_date, import_source, released
# Last resort: file mtime # Last resort: file mtime (if allowed)
if config.allow_file_date_fallback:
return self._get_file_mtime_date(movie_path) return self._get_file_mtime_date(movie_path)
else:
_log("INFO", f"No valid dates found for {imdb_id} and file date fallback disabled - skipping NFO creation")
return None, "no_valid_date_source", None
def _get_digital_release_date(self, imdb_id: str) -> Tuple[Optional[str], str]: def _get_digital_release_date(self, imdb_id: str) -> Tuple[Optional[str], str]:
"""Get release date from external sources using configured priority""" """Get release date from external sources using configured priority"""