Fixed history logging of downloaded and uploaded subtitles. #2261

This commit is contained in:
morpheus65535 2023-10-08 09:20:46 -04:00
parent 0f216ab69f
commit 2972c3881c
9 changed files with 26 additions and 2 deletions

View File

@ -157,6 +157,8 @@ class EpisodesSubtitles(Resource):
if not result:
logging.debug(f"BAZARR unable to process subtitles for this episode: {episodePath}")
else:
if isinstance(result, tuple) and len(result):
result = result[0]
provider = "manual"
score = 360
history_log(4, sonarrSeriesId, sonarrEpisodeId, result, fake_provider=provider, fake_score=score)

View File

@ -153,6 +153,8 @@ class MoviesSubtitles(Resource):
if not result:
logging.debug(f"BAZARR unable to process subtitles for this movie: {moviePath}")
else:
if isinstance(result, tuple) and len(result):
result = result[0]
provider = "manual"
score = 120
history_log_movie(4, radarrId, result, fake_provider=provider, fake_score=score)

View File

@ -137,6 +137,8 @@ class ProviderEpisodes(Resource):
except OSError:
return 'Unable to save subtitles file', 500
else:
if isinstance(result, tuple) and len(result):
result = result[0]
if isinstance(result, ProcessSubtitlesResult):
history_log(2, sonarrSeriesId, sonarrEpisodeId, result)
if not settings.general.getboolean('dont_notify_manual_actions'):

View File

@ -131,6 +131,8 @@ class ProviderMovies(Resource):
except OSError:
return 'Unable to save subtitles file', 500
else:
if isinstance(result, tuple) and len(result):
result = result[0]
if isinstance(result, ProcessSubtitlesResult):
history_log_movie(2, radarrId, result)
if not settings.general.getboolean('dont_notify_manual_actions'):

View File

@ -82,6 +82,8 @@ def movies_download_subtitles(no):
check_if_still_required=True):
if result:
if isinstance(result, tuple) and len(result):
result = result[0]
store_subtitles_movie(movie.path, moviePath)
history_log_movie(1, no, result)
send_notifications_movie(no, result.message)

View File

@ -92,6 +92,8 @@ def series_download_subtitles(no):
'series',
check_if_still_required=True):
if result:
if isinstance(result, tuple) and len(result):
result = result[0]
store_subtitles(episode.path, path_mappings.path_replace(episode.path))
history_log(1, no, episode.sonarrEpisodeId, result)
send_notifications(no, episode.sonarrEpisodeId, result.message)
@ -165,6 +167,8 @@ def episode_download_subtitles(no, send_progress=False):
'series',
check_if_still_required=True):
if result:
if isinstance(result, tuple) and len(result):
result = result[0]
store_subtitles(episode.path, path_mappings.path_replace(episode.path))
history_log(1, episode.sonarrSeriesId, episode.sonarrEpisodeId, result)
send_notifications(episode.sonarrSeriesId, episode.sonarrEpisodeId, result.message)

View File

@ -116,7 +116,10 @@ def upgrade_subtitles():
is_upgrade=True))
if result:
result = result[0]
if isinstance(result, list) and len(result):
result = result[0]
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)
send_notifications(episode['sonarrSeriesId'], episode['sonarrEpisodeId'], result.message)
@ -197,7 +200,10 @@ def upgrade_subtitles():
forced_minimum_score=int(movie['score']),
is_upgrade=True))
if result:
result = result[0]
if isinstance(result, list) and len(result):
result = result[0]
if isinstance(result, tuple) and len(result):
result = result[0]
store_subtitles_movie(movie['video_path'],
path_mappings.path_replace_movie(movie['video_path']))
history_log_movie(3, movie['radarrId'], result)

View File

@ -53,6 +53,8 @@ def _wanted_movie(movie):
check_if_still_required=True):
if result:
if isinstance(result, tuple) and len(result):
result = result[0]
store_subtitles_movie(movie.path, path_mappings.path_replace_movie(movie.path))
history_log_movie(1, movie.radarrId, result)
event_stream(type='movie-wanted', action='delete', payload=movie.radarrId)

View File

@ -53,6 +53,8 @@ def _wanted_episode(episode):
'series',
check_if_still_required=True):
if result:
if isinstance(result, tuple) and len(result):
result = result[0]
store_subtitles(episode.path, path_mappings.path_replace(episode.path))
history_log(1, episode.sonarrSeriesId, episode.sonarrEpisodeId, result)
event_stream(type='series', action='update', payload=episode.sonarrSeriesId)