This commit is contained in:
@@ -116,6 +116,18 @@ class DatabasePopulator:
|
|||||||
if not existing_path or existing_path == 'unknown' or existing_path != path:
|
if not existing_path or existing_path == 'unknown' or existing_path != path:
|
||||||
_log("INFO", f"Movie {imdb_id} exists but updating file info: {path}")
|
_log("INFO", f"Movie {imdb_id} exists but updating file info: {path}")
|
||||||
self.db.update_movie_file_info(imdb_id, path, has_video_file=True)
|
self.db.update_movie_file_info(imdb_id, path, has_video_file=True)
|
||||||
|
|
||||||
|
# Add to processing history
|
||||||
|
try:
|
||||||
|
self.db.add_processing_history(
|
||||||
|
imdb_id=imdb_id,
|
||||||
|
media_type='movie',
|
||||||
|
event_type='file_info_update',
|
||||||
|
details={'path': path}
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
_log("WARNING", f"Failed to add processing history for {imdb_id}: {e}")
|
||||||
|
|
||||||
stats['updated'] += 1
|
stats['updated'] += 1
|
||||||
else:
|
else:
|
||||||
_log("DEBUG", f"Movie {imdb_id} already in database with correct path, skipping")
|
_log("DEBUG", f"Movie {imdb_id} already in database with correct path, skipping")
|
||||||
@@ -201,6 +213,18 @@ class DatabasePopulator:
|
|||||||
imdb_id, released, dateadded, source,
|
imdb_id, released, dateadded, source,
|
||||||
has_video_file=True, title=title, year=year
|
has_video_file=True, title=title, year=year
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Add to processing history
|
||||||
|
try:
|
||||||
|
self.db.add_processing_history(
|
||||||
|
imdb_id=imdb_id,
|
||||||
|
media_type='movie',
|
||||||
|
event_type='database_population',
|
||||||
|
details={'source': source, 'title': title}
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
_log("WARNING", f"Failed to add processing history for {imdb_id}: {e}")
|
||||||
|
|
||||||
stats['added'] += 1
|
stats['added'] += 1
|
||||||
_log("DEBUG", f"Added movie {imdb_id}: {title} ({year}) (source: {source})")
|
_log("DEBUG", f"Added movie {imdb_id}: {title} ({year}) (source: {source})")
|
||||||
|
|
||||||
@@ -320,6 +344,18 @@ class DatabasePopulator:
|
|||||||
if not existing_path or existing_path == 'unknown' or existing_path != episode_path:
|
if not existing_path or existing_path == 'unknown' or existing_path != episode_path:
|
||||||
_log("INFO", f"Episode {imdb_id} S{season_num:02d}E{episode_num:02d} exists but updating file info: {episode_path}")
|
_log("INFO", f"Episode {imdb_id} S{season_num:02d}E{episode_num:02d} exists but updating file info: {episode_path}")
|
||||||
self.db.update_episode_file_info(imdb_id, season_num, episode_num, episode_path, has_video_file=True)
|
self.db.update_episode_file_info(imdb_id, season_num, episode_num, episode_path, has_video_file=True)
|
||||||
|
|
||||||
|
# Add to processing history
|
||||||
|
try:
|
||||||
|
self.db.add_processing_history(
|
||||||
|
imdb_id=imdb_id,
|
||||||
|
media_type='episode',
|
||||||
|
event_type='file_info_update',
|
||||||
|
details={'season': season_num, 'episode': episode_num, 'path': episode_path}
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
_log("WARNING", f"Failed to add processing history for {imdb_id} S{season_num:02d}E{episode_num:02d}: {e}")
|
||||||
|
|
||||||
stats['updated'] += 1
|
stats['updated'] += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -376,6 +412,18 @@ class DatabasePopulator:
|
|||||||
|
|
||||||
# Insert into database
|
# Insert into database
|
||||||
self.db.upsert_episode_date(imdb_id, season_num, episode_num, aired, dateadded, source, has_file)
|
self.db.upsert_episode_date(imdb_id, season_num, episode_num, aired, dateadded, source, has_file)
|
||||||
|
|
||||||
|
# Add to processing history
|
||||||
|
try:
|
||||||
|
self.db.add_processing_history(
|
||||||
|
imdb_id=imdb_id,
|
||||||
|
media_type='episode',
|
||||||
|
event_type='database_population',
|
||||||
|
details={'season': season_num, 'episode': episode_num, 'source': source, 'title': episode_title}
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
_log("WARNING", f"Failed to add processing history for {imdb_id} S{season_num:02d}E{episode_num:02d}: {e}")
|
||||||
|
|
||||||
stats['added'] += 1
|
stats['added'] += 1
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user