From d9b9a6265dbdb6fa410e7c4d55fcafeb39d231d3 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Mon, 1 Feb 2021 06:39:47 -0500 Subject: [PATCH] Fix for #1253. --- bazarr/database.py | 54 ++++++++++++++++++++++++++---------------- bazarr/get_subtitle.py | 2 ++ 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/bazarr/database.py b/bazarr/database.py index 06f43e0bb..aa7c033bf 100644 --- a/bazarr/database.py +++ b/bazarr/database.py @@ -316,32 +316,44 @@ def get_audio_profile_languages(series_id=None, episode_id=None, movie_id=None): if series_id: audio_languages_list_str = database.execute("SELECT audio_language FROM table_shows WHERE sonarrSeriesId=?", (series_id,), only_one=True)['audio_language'] - audio_languages_list = ast.literal_eval(audio_languages_list_str) - for language in audio_languages_list: - audio_languages.append( - {"name": language, - "code2": alpha2_from_language(language) or None, - "code3": alpha3_from_language(language) or None} - ) + try: + audio_languages_list = ast.literal_eval(audio_languages_list_str) + except ValueError: + pass + else: + for language in audio_languages_list: + audio_languages.append( + {"name": language, + "code2": alpha2_from_language(language) or None, + "code3": alpha3_from_language(language) or None} + ) elif episode_id: audio_languages_list_str = database.execute("SELECT audio_language FROM table_episodes WHERE sonarrEpisodeId=?", (episode_id,), only_one=True)['audio_language'] - audio_languages_list = ast.literal_eval(audio_languages_list_str) - for language in audio_languages_list: - audio_languages.append( - {"name": language, - "code2": alpha2_from_language(language) or None, - "code3": alpha3_from_language(language) or None} - ) + try: + audio_languages_list = ast.literal_eval(audio_languages_list_str) + except ValueError: + pass + else: + for language in audio_languages_list: + audio_languages.append( + {"name": language, + "code2": alpha2_from_language(language) or None, + "code3": alpha3_from_language(language) or None} + ) elif movie_id: audio_languages_list_str = database.execute("SELECT audio_language FROM table_movies WHERE radarrId=?", (movie_id,), only_one=True)['audio_language'] - audio_languages_list = ast.literal_eval(audio_languages_list_str) - for language in audio_languages_list: - audio_languages.append( - {"name": language, - "code2": alpha2_from_language(language) or None, - "code3": alpha3_from_language(language) or None} - ) + try: + audio_languages_list = ast.literal_eval(audio_languages_list_str) + except ValueError: + pass + else: + for language in audio_languages_list: + audio_languages.append( + {"name": language, + "code2": alpha2_from_language(language) or None, + "code3": alpha3_from_language(language) or None} + ) return audio_languages diff --git a/bazarr/get_subtitle.py b/bazarr/get_subtitle.py index 115b24a8e..810bd081e 100644 --- a/bazarr/get_subtitle.py +++ b/bazarr/get_subtitle.py @@ -1375,6 +1375,8 @@ def upgrade_subtitles(): history_log_movie(3, movie['radarrId'], message, path, language_code, provider, score, subs_id, subs_path) send_notifications_movie(movie['radarrId'], message) + logging.info('BAZARR Finished searching for Subtitles to upgrade. Check History for more information.') + def postprocessing(command, path): try: