diff options
author | morpheus65535 <[email protected]> | 2023-10-08 09:20:46 -0400 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2023-10-08 09:20:46 -0400 |
commit | 2972c3881c525cad183d66e2540459c0f19cad77 (patch) | |
tree | f8d4c26ca0e0ee4244cdddb026408caa516e8513 | |
parent | 0f216ab69f5d2b386e101f27e679513942d05e41 (diff) | |
download | bazarr-2972c3881c525cad183d66e2540459c0f19cad77.tar.gz bazarr-2972c3881c525cad183d66e2540459c0f19cad77.zip |
Fixed history logging of downloaded and uploaded subtitles. #2261v1.3.1-beta.8
-rw-r--r-- | bazarr/api/episodes/episodes_subtitles.py | 2 | ||||
-rw-r--r-- | bazarr/api/movies/movies_subtitles.py | 2 | ||||
-rw-r--r-- | bazarr/api/providers/providers_episodes.py | 2 | ||||
-rw-r--r-- | bazarr/api/providers/providers_movies.py | 2 | ||||
-rw-r--r-- | bazarr/subtitles/mass_download/movies.py | 2 | ||||
-rw-r--r-- | bazarr/subtitles/mass_download/series.py | 4 | ||||
-rw-r--r-- | bazarr/subtitles/upgrade.py | 10 | ||||
-rw-r--r-- | bazarr/subtitles/wanted/movies.py | 2 | ||||
-rw-r--r-- | bazarr/subtitles/wanted/series.py | 2 |
9 files changed, 26 insertions, 2 deletions
diff --git a/bazarr/api/episodes/episodes_subtitles.py b/bazarr/api/episodes/episodes_subtitles.py index 9207b3c28..cdb66992d 100644 --- a/bazarr/api/episodes/episodes_subtitles.py +++ b/bazarr/api/episodes/episodes_subtitles.py @@ -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) diff --git a/bazarr/api/movies/movies_subtitles.py b/bazarr/api/movies/movies_subtitles.py index bf7cebebf..f544cd8cb 100644 --- a/bazarr/api/movies/movies_subtitles.py +++ b/bazarr/api/movies/movies_subtitles.py @@ -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) diff --git a/bazarr/api/providers/providers_episodes.py b/bazarr/api/providers/providers_episodes.py index fb764412e..c7a20e151 100644 --- a/bazarr/api/providers/providers_episodes.py +++ b/bazarr/api/providers/providers_episodes.py @@ -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'): diff --git a/bazarr/api/providers/providers_movies.py b/bazarr/api/providers/providers_movies.py index 0fd7f233c..0df6a5f08 100644 --- a/bazarr/api/providers/providers_movies.py +++ b/bazarr/api/providers/providers_movies.py @@ -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'): diff --git a/bazarr/subtitles/mass_download/movies.py b/bazarr/subtitles/mass_download/movies.py index 9d7ea4e71..fee57b2dd 100644 --- a/bazarr/subtitles/mass_download/movies.py +++ b/bazarr/subtitles/mass_download/movies.py @@ -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) diff --git a/bazarr/subtitles/mass_download/series.py b/bazarr/subtitles/mass_download/series.py index 4a9dda021..43d85cfd6 100644 --- a/bazarr/subtitles/mass_download/series.py +++ b/bazarr/subtitles/mass_download/series.py @@ -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) diff --git a/bazarr/subtitles/upgrade.py b/bazarr/subtitles/upgrade.py index 859d0ce36..ffa734c06 100644 --- a/bazarr/subtitles/upgrade.py +++ b/bazarr/subtitles/upgrade.py @@ -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) diff --git a/bazarr/subtitles/wanted/movies.py b/bazarr/subtitles/wanted/movies.py index d850495ce..16c363386 100644 --- a/bazarr/subtitles/wanted/movies.py +++ b/bazarr/subtitles/wanted/movies.py @@ -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) diff --git a/bazarr/subtitles/wanted/series.py b/bazarr/subtitles/wanted/series.py index 256ab6c28..0d7cd2375 100644 --- a/bazarr/subtitles/wanted/series.py +++ b/bazarr/subtitles/wanted/series.py @@ -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) |