Skip to content

Commit

Permalink
Reverted last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus65535 committed Oct 31, 2024
1 parent 2c8712f commit db450bd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 3 additions & 2 deletions bazarr/radarr/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
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
Expand All @@ -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')
6 changes: 4 additions & 2 deletions bazarr/sonarr/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
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
Expand All @@ -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')
9 changes: 6 additions & 3 deletions bazarr/subtitles/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,16 @@ 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')

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,
Expand All @@ -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,
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit db450bd

Please sign in to comment.