diff options
author | morpheus65535 <[email protected]> | 2024-10-30 23:05:07 -0400 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2024-10-30 23:05:07 -0400 |
commit | a70b26cdbe520e75966af91f0be96d779bdfee0d (patch) | |
tree | 6c60cb7f2339771ddc5a60e915251c988ed74684 | |
parent | 2c8712f8913169db6bae2e8e66903dafa3d88a98 (diff) | |
download | bazarr-a70b26cdbe520e75966af91f0be96d779bdfee0d.tar.gz bazarr-a70b26cdbe520e75966af91f0be96d779bdfee0d.zip |
Added logging of upgraded subtitles original ID to database
-rw-r--r-- | bazarr/radarr/history.py | 5 | ||||
-rw-r--r-- | bazarr/sonarr/history.py | 6 | ||||
-rw-r--r-- | bazarr/subtitles/upgrade.py | 9 |
3 files changed, 13 insertions, 7 deletions
diff --git a/bazarr/radarr/history.py b/bazarr/radarr/history.py index 79b301c2d..d0cfe78c7 100644 --- a/bazarr/radarr/history.py +++ b/bazarr/radarr/history.py @@ -6,7 +6,7 @@ from app.database import TableHistoryMovie, database, insert from app.event_handler import event_stream -def history_log_movie(action, radarr_id, result, fake_provider=None, fake_score=None): +def history_log_movie(action, radarr_id, result, fake_provider=None, fake_score=None, upgraded_from_id=None): description = result.message video_path = result.path language = result.language_code @@ -31,6 +31,7 @@ def history_log_movie(action, radarr_id, result, fake_provider=None, fake_score= subs_id=subs_id, subtitles_path=subtitles_path, matched=str(matched) if matched else None, - not_matched=str(not_matched) if not_matched else None + not_matched=str(not_matched) if not_matched else None, + upgradedFromId=upgraded_from_id, )) event_stream(type='movie-history') diff --git a/bazarr/sonarr/history.py b/bazarr/sonarr/history.py index 7d85ca0ab..c3f285aab 100644 --- a/bazarr/sonarr/history.py +++ b/bazarr/sonarr/history.py @@ -6,7 +6,8 @@ from app.database import TableHistory, database, insert from app.event_handler import event_stream -def history_log(action, sonarr_series_id, sonarr_episode_id, result, fake_provider=None, fake_score=None): +def history_log(action, sonarr_series_id, sonarr_episode_id, result, fake_provider=None, fake_score=None, + upgraded_from_id=None): description = result.message video_path = result.path language = result.language_code @@ -32,6 +33,7 @@ def history_log(action, sonarr_series_id, sonarr_episode_id, result, fake_provid subs_id=subs_id, subtitles_path=subtitles_path, matched=str(matched) if matched else None, - not_matched=str(not_matched) if not_matched else None + not_matched=str(not_matched) if not_matched else None, + upgradedFromId=upgraded_from_id, )) event_stream(type='episode-history') diff --git a/bazarr/subtitles/upgrade.py b/bazarr/subtitles/upgrade.py index 1f73218a2..3c6f12795 100644 --- a/bazarr/subtitles/upgrade.py +++ b/bazarr/subtitles/upgrade.py @@ -124,7 +124,8 @@ def upgrade_subtitles(): if isinstance(result, tuple) and len(result): result = result[0] store_subtitles(episode['video_path'], path_mappings.path_replace(episode['video_path'])) - history_log(3, episode['sonarrSeriesId'], episode['sonarrEpisodeId'], result) + history_log(3, episode['sonarrSeriesId'], episode['sonarrEpisodeId'], result, + upgraded_from_id=episode['id']) send_notifications(episode['sonarrSeriesId'], episode['sonarrEpisodeId'], result.message) hide_progress(id='upgrade_episodes_progress') @@ -132,6 +133,7 @@ def upgrade_subtitles(): if use_radarr: movies_to_upgrade = get_upgradable_movies_subtitles() movies_data = [{ + 'id': x.id, 'title': x.title, 'language': x.language, 'audio_language': x.audio_language, @@ -145,7 +147,8 @@ def upgrade_subtitles(): 'external_subtitles': [y[1] for y in ast.literal_eval(x.external_subtitles) if y[1]], 'upgradable': bool(x.upgradable), } for x in database.execute( - select(TableMovies.title, + select(TableHistoryMovie.id, + TableMovies.title, TableHistoryMovie.language, TableMovies.audio_language, TableHistoryMovie.video_path, @@ -215,7 +218,7 @@ def upgrade_subtitles(): result = result[0] store_subtitles_movie(movie['video_path'], path_mappings.path_replace_movie(movie['video_path'])) - history_log_movie(3, movie['radarrId'], result) + history_log_movie(3, movie['radarrId'], result, upgraded_from_id=movie['id']) send_notifications_movie(movie['radarrId'], result.message) hide_progress(id='upgrade_movies_progress') |