This commit is contained in:
@@ -215,7 +215,8 @@ class DatabasePopulator:
|
||||
'updated': 0,
|
||||
'skipped': 0,
|
||||
'errors': 0,
|
||||
'duration': 0.0
|
||||
'duration': 0.0,
|
||||
'skipped_items': [] # Track what was skipped and why
|
||||
}
|
||||
|
||||
try:
|
||||
@@ -267,6 +268,7 @@ class DatabasePopulator:
|
||||
try:
|
||||
season_num = episode.get('seasonNumber', 0)
|
||||
episode_num = episode.get('episodeNumber', 0)
|
||||
episode_title = episode.get('title', 'Unknown')
|
||||
|
||||
if season_num < 0 or episode_num <= 0:
|
||||
continue
|
||||
@@ -276,12 +278,28 @@ class DatabasePopulator:
|
||||
# Check if episode already exists
|
||||
existing = self.db.get_episode_date(imdb_id, season_num, episode_num)
|
||||
if existing and existing.get('dateadded'):
|
||||
skip_info = {
|
||||
'title': series_title,
|
||||
'episode_title': episode_title,
|
||||
'season': season_num,
|
||||
'episode': episode_num,
|
||||
'reason': 'Already in database'
|
||||
}
|
||||
stats['skipped_items'].append(skip_info)
|
||||
stats['skipped'] += 1
|
||||
continue
|
||||
|
||||
# Only process episodes that have video files
|
||||
has_file = episode.get('hasFile', False)
|
||||
if not has_file:
|
||||
skip_info = {
|
||||
'title': series_title,
|
||||
'episode_title': episode_title,
|
||||
'season': season_num,
|
||||
'episode': episode_num,
|
||||
'reason': 'No video file'
|
||||
}
|
||||
stats['skipped_items'].append(skip_info)
|
||||
stats['skipped'] += 1
|
||||
continue
|
||||
|
||||
@@ -310,6 +328,14 @@ class DatabasePopulator:
|
||||
source = 'sonarr:aired_fallback'
|
||||
elif not dateadded:
|
||||
# No date available
|
||||
skip_info = {
|
||||
'title': series_title,
|
||||
'episode_title': episode_title,
|
||||
'season': season_num,
|
||||
'episode': episode_num,
|
||||
'reason': 'No import date from Sonarr history and no air date available'
|
||||
}
|
||||
stats['skipped_items'].append(skip_info)
|
||||
stats['skipped'] += 1
|
||||
continue
|
||||
|
||||
@@ -333,6 +359,15 @@ class DatabasePopulator:
|
||||
|
||||
stats['duration'] = time.time() - start_time
|
||||
_log("INFO", f"TV episode 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 episodes details ({len(stats['skipped_items'])} total):")
|
||||
for item in stats['skipped_items'][:20]: # Only log first 20 to avoid spam
|
||||
_log("INFO", f" - {item['title']} S{str(item['season']).zfill(2)}E{str(item['episode']).zfill(2)} ({item.get('episode_title', 'Unknown')}): {item['reason']}")
|
||||
if len(stats['skipped_items']) > 20:
|
||||
_log("INFO", f" ... and {len(stats['skipped_items']) - 20} more (see web interface for full list)")
|
||||
|
||||
return stats
|
||||
|
||||
def populate_all(self) -> Dict[str, any]:
|
||||
|
||||
Reference in New Issue
Block a user