This commit is contained in:
@@ -47,7 +47,8 @@ class DatabasePopulator:
|
||||
'updated': 0,
|
||||
'skipped': 0,
|
||||
'errors': 0,
|
||||
'duration': 0.0
|
||||
'duration': 0.0,
|
||||
'skipped_items': [] # Track what was skipped and why
|
||||
}
|
||||
|
||||
try:
|
||||
@@ -81,6 +82,13 @@ class DatabasePopulator:
|
||||
_log("DEBUG", f"Extracted IMDb ID {imdb_id} from path for: {movie.get('title')}")
|
||||
|
||||
if not imdb_id:
|
||||
skip_info = {
|
||||
'title': movie.get('title', 'Unknown'),
|
||||
'year': movie.get('year'),
|
||||
'path': path,
|
||||
'reason': 'No IMDb ID found'
|
||||
}
|
||||
stats['skipped_items'].append(skip_info)
|
||||
_log("DEBUG", f"Skipping movie without IMDb ID: {movie.get('title')} (path: {path})")
|
||||
stats['skipped'] += 1
|
||||
continue
|
||||
@@ -88,6 +96,13 @@ class DatabasePopulator:
|
||||
# Check if movie already exists in database
|
||||
existing = self.db.get_movie_dates(imdb_id)
|
||||
if existing and existing.get('dateadded'):
|
||||
skip_info = {
|
||||
'title': movie.get('title', 'Unknown'),
|
||||
'year': movie.get('year'),
|
||||
'imdb_id': imdb_id,
|
||||
'reason': 'Already in database'
|
||||
}
|
||||
stats['skipped_items'].append(skip_info)
|
||||
_log("DEBUG", f"Movie {imdb_id} already in database, skipping")
|
||||
stats['skipped'] += 1
|
||||
continue
|
||||
@@ -119,6 +134,13 @@ class DatabasePopulator:
|
||||
dateadded = released
|
||||
source = f'{source_type}_fallback'
|
||||
else:
|
||||
skip_info = {
|
||||
'title': movie.get('title', 'Unknown'),
|
||||
'year': movie.get('year'),
|
||||
'imdb_id': imdb_id,
|
||||
'reason': 'No import date in Radarr history and no release dates available'
|
||||
}
|
||||
stats['skipped_items'].append(skip_info)
|
||||
_log("DEBUG", f"No date available for movie {imdb_id}, skipping")
|
||||
stats['skipped'] += 1
|
||||
continue
|
||||
@@ -127,6 +149,13 @@ class DatabasePopulator:
|
||||
dateadded = released
|
||||
source = f'{source_type}_fallback'
|
||||
else:
|
||||
skip_info = {
|
||||
'title': movie.get('title', 'Unknown'),
|
||||
'year': movie.get('year'),
|
||||
'imdb_id': imdb_id,
|
||||
'reason': 'No Radarr movie ID and no release dates available'
|
||||
}
|
||||
stats['skipped_items'].append(skip_info)
|
||||
_log("DEBUG", f"No date available for movie {imdb_id}, skipping")
|
||||
stats['skipped'] += 1
|
||||
continue
|
||||
@@ -152,6 +181,13 @@ class DatabasePopulator:
|
||||
|
||||
stats['duration'] = time.time() - start_time
|
||||
_log("INFO", f"Movie population complete: {stats['added']} added, {stats['skipped']} skipped, {stats['errors']} errors in {stats['duration']:.2f}s")
|
||||
|
||||
# Log details of skipped items
|
||||
if stats['skipped_items']:
|
||||
_log("INFO", f"Skipped items details ({len(stats['skipped_items'])} total):")
|
||||
for item in stats['skipped_items']:
|
||||
_log("INFO", f" - {item['title']} ({item.get('year', 'N/A')}) [{item.get('imdb_id', 'No IMDb')}]: {item['reason']}")
|
||||
|
||||
return stats
|
||||
|
||||
def populate_tv_episodes(self) -> Dict[str, any]:
|
||||
|
||||
Reference in New Issue
Block a user