This commit is contained in:
morpheus65535 2021-02-01 06:39:47 -05:00
parent f93af2f3e0
commit d9b9a6265d
2 changed files with 35 additions and 21 deletions

View File

@ -316,32 +316,44 @@ def get_audio_profile_languages(series_id=None, episode_id=None, movie_id=None):
if series_id: if series_id:
audio_languages_list_str = database.execute("SELECT audio_language FROM table_shows WHERE sonarrSeriesId=?", audio_languages_list_str = database.execute("SELECT audio_language FROM table_shows WHERE sonarrSeriesId=?",
(series_id,), only_one=True)['audio_language'] (series_id,), only_one=True)['audio_language']
audio_languages_list = ast.literal_eval(audio_languages_list_str) try:
for language in audio_languages_list: audio_languages_list = ast.literal_eval(audio_languages_list_str)
audio_languages.append( except ValueError:
{"name": language, pass
"code2": alpha2_from_language(language) or None, else:
"code3": alpha3_from_language(language) or None} 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: elif episode_id:
audio_languages_list_str = database.execute("SELECT audio_language FROM table_episodes WHERE sonarrEpisodeId=?", audio_languages_list_str = database.execute("SELECT audio_language FROM table_episodes WHERE sonarrEpisodeId=?",
(episode_id,), only_one=True)['audio_language'] (episode_id,), only_one=True)['audio_language']
audio_languages_list = ast.literal_eval(audio_languages_list_str) try:
for language in audio_languages_list: audio_languages_list = ast.literal_eval(audio_languages_list_str)
audio_languages.append( except ValueError:
{"name": language, pass
"code2": alpha2_from_language(language) or None, else:
"code3": alpha3_from_language(language) or None} 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: elif movie_id:
audio_languages_list_str = database.execute("SELECT audio_language FROM table_movies WHERE radarrId=?", audio_languages_list_str = database.execute("SELECT audio_language FROM table_movies WHERE radarrId=?",
(movie_id,), only_one=True)['audio_language'] (movie_id,), only_one=True)['audio_language']
audio_languages_list = ast.literal_eval(audio_languages_list_str) try:
for language in audio_languages_list: audio_languages_list = ast.literal_eval(audio_languages_list_str)
audio_languages.append( except ValueError:
{"name": language, pass
"code2": alpha2_from_language(language) or None, else:
"code3": alpha3_from_language(language) or None} 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 return audio_languages

View File

@ -1375,6 +1375,8 @@ def upgrade_subtitles():
history_log_movie(3, movie['radarrId'], message, path, language_code, provider, score, subs_id, subs_path) history_log_movie(3, movie['radarrId'], message, path, language_code, provider, score, subs_id, subs_path)
send_notifications_movie(movie['radarrId'], message) send_notifications_movie(movie['radarrId'], message)
logging.info('BAZARR Finished searching for Subtitles to upgrade. Check History for more information.')
def postprocessing(command, path): def postprocessing(command, path):
try: try: