Fixed issue with unrecognized languages while indexing subtitles (mainly for those without a language code in filename).

pull/1695/head
morpheus65535 3 years ago
parent 415087fd13
commit 28663a6937

@ -86,7 +86,10 @@ def store_subtitles(original_path, reversed_path, use_cache=True):
logging.exception("BAZARR unable to index external subtitles.") logging.exception("BAZARR unable to index external subtitles.")
else: else:
for subtitle, language in subtitles.items(): for subtitle, language in subtitles.items():
valid_language = alpha2_from_alpha3(language.alpha3) valid_language = False
if language:
if hasattr(language, 'alpha3'):
valid_language = alpha2_from_alpha3(language.alpha3)
if not valid_language: if not valid_language:
logging.debug(f'{language.alpha3} is an unsupported language code.') logging.debug(f'{language.alpha3} is an unsupported language code.')
continue continue
@ -190,7 +193,10 @@ def store_subtitles_movie(original_path, reversed_path, use_cache=True):
pass pass
else: else:
for subtitle, language in subtitles.items(): for subtitle, language in subtitles.items():
valid_language = alpha2_from_alpha3(language.alpha3) valid_language = False
if language:
if hasattr(language, 'alpha3'):
valid_language = alpha2_from_alpha3(language.alpha3)
if not valid_language: if not valid_language:
logging.debug(f'{language.alpha3} is an unsupported language code.') logging.debug(f'{language.alpha3} is an unsupported language code.')
continue continue

Loading…
Cancel
Save