diff --git a/bazarr/subtitles/indexer/utils.py b/bazarr/subtitles/indexer/utils.py index 222a66a8f..63b9dee6d 100644 --- a/bazarr/subtitles/indexer/utils.py +++ b/bazarr/subtitles/indexer/utils.py @@ -2,7 +2,6 @@ import os import logging -import re from guess_language import guess_language from subliminal_patch import core @@ -136,6 +135,7 @@ def guess_external_subtitles(dest_folder, subtitles, media_type, previously_inde continue text = text.decode(encoding) - if core.parse_for_hi_regex(subtitle_text=text, alpha3_language=language.alpha3): + if core.parse_for_hi_regex(subtitle_text=text, + alpha3_language=language.alpha3 if hasattr(language, 'alpha3') else None): subtitles[subtitle] = Language.rebuild(subtitles[subtitle], forced=False, hi=True) return subtitles diff --git a/custom_libs/subliminal_patch/core.py b/custom_libs/subliminal_patch/core.py index f0d7f3618..0fc2ac0a7 100644 --- a/custom_libs/subliminal_patch/core.py +++ b/custom_libs/subliminal_patch/core.py @@ -1213,7 +1213,10 @@ def save_subtitles(file_path, subtitles, single=False, directory=None, chmod=Non continue # create subtitle path - if subtitle.text and parse_for_hi_regex(subtitle_text=subtitle.text, alpha3_language=subtitle.language.alpha3): + if subtitle.text and parse_for_hi_regex(subtitle_text=subtitle.text, + alpha3_language=subtitle.language.alpha3 if + (hasattr(subtitle, 'language') and hasattr(subtitle.language, 'alpha3')) + else None): subtitle.language.hi = True subtitle_path = get_subtitle_path(file_path, None if single else subtitle.language, forced_tag=subtitle.language.forced,