From 9d30414f9dd1797f17149e403d56f6b0b368a47d Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Sun, 16 Jan 2022 17:21:36 -0500 Subject: [PATCH] Fixed indexing of unsupported language codes. #1683 --- bazarr/list_subtitles.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bazarr/list_subtitles.py b/bazarr/list_subtitles.py index 336b5449b..044bf94f3 100644 --- a/bazarr/list_subtitles.py +++ b/bazarr/list_subtitles.py @@ -86,7 +86,9 @@ def store_subtitles(original_path, reversed_path, use_cache=True): logging.exception("BAZARR unable to index external subtitles.") else: for subtitle, language in subtitles.items(): - if not language: + valid_language = alpha2_from_alpha3(language.alpha3) + if not valid_language: + logging.debug(f'{language.alpha3} is an unsupported language code.') continue subtitle_path = get_external_subtitles_path(reversed_path, subtitle) @@ -188,7 +190,9 @@ def store_subtitles_movie(original_path, reversed_path, use_cache=True): pass else: for subtitle, language in subtitles.items(): - if not language: + valid_language = alpha2_from_alpha3(language.alpha3) + if not valid_language: + logging.debug(f'{language.alpha3} is an unsupported language code.') continue subtitle_path = get_external_subtitles_path(reversed_path, subtitle)