feat: Add three-tier optimization for maximum performance
Local Docker Build (Dev) / build-dev (push) Successful in 19s
Local Docker Build (Dev) / build-dev (push) Successful in 19s
Implemented smart caching system that dramatically reduces processing time: TIER 1 (Fastest): NFO File Check - If NFO already has NFOGuard dateadded + lockdata, use it directly - Skips both database queries AND API calls - Perfect for movies already processed by NFOGuard TIER 2 (Fast): Database Check - If database has complete dateadded data, use it - Skips expensive API calls to TMDB/OMDB/Radarr - Creates NFO from cached data TIER 3 (Slowest): Full Processing - Only when neither NFO nor database have data - Queries all APIs, processes dates, saves to database This should dramatically improve full scan performance, especially on subsequent runs where most movies already have NFOGuard data. Expected speedup: 90%+ reduction in processing time for warm scans.
This commit is contained in:
+17
-1
@@ -970,7 +970,23 @@ class MovieProcessor:
|
||||
self.db.upsert_movie_dates(imdb_id, None, None, None, False)
|
||||
return
|
||||
|
||||
# Get existing dates
|
||||
# TIER 1: Check if NFO file already has NFOGuard data (fastest - no DB or API calls)
|
||||
nfo_path = movie_path / "movie.nfo"
|
||||
nfo_data = self.nfo_manager.extract_nfoguard_dates_from_nfo(nfo_path)
|
||||
if nfo_data:
|
||||
_log("INFO", f"🚀 Using existing NFOGuard data from NFO file: {nfo_data['dateadded']} (source: {nfo_data['source']})")
|
||||
dateadded = nfo_data["dateadded"]
|
||||
source = nfo_data["source"]
|
||||
released = nfo_data.get("released")
|
||||
|
||||
# Update file mtimes if enabled (NFO is already correct)
|
||||
if config.fix_dir_mtimes and dateadded:
|
||||
self.nfo_manager.update_movie_files_mtime(movie_path, dateadded)
|
||||
|
||||
_log("INFO", f"Completed processing movie: {movie_path.name} (source: {source}) [nfo-only]")
|
||||
return
|
||||
|
||||
# TIER 2: Check database for existing data
|
||||
existing = self.db.get_movie_dates(imdb_id)
|
||||
_log("DEBUG", f"Database lookup for {imdb_id}: {existing}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user