mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-12-23 23:59:04 -05:00
Added logging of upgraded subtitles original ID to database
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user