mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-01-11 01:07:36 +08:00
Fix for #1114.
This commit is contained in:
parent
29671a4aff
commit
c68180ec09
1 changed files with 3 additions and 2 deletions
|
@ -414,6 +414,7 @@ def guess_external_subtitles(dest_folder, subtitles):
|
|||
|
||||
try:
|
||||
text = text.decode('utf-8')
|
||||
detected_language = guess_language(text)
|
||||
except UnicodeDecodeError:
|
||||
detector = Detector()
|
||||
guess = detector.detect(text)
|
||||
|
@ -421,7 +422,7 @@ def guess_external_subtitles(dest_folder, subtitles):
|
|||
text = text.decode(guess)
|
||||
detected_language = guess_language(text)
|
||||
except:
|
||||
pass
|
||||
logging.debug('BAZARR was unable to detect encoding for this subtitles file: %r', subtitle_path)
|
||||
finally:
|
||||
if detected_language:
|
||||
logging.debug("BAZARR external subtitles detected and guessed this language: " + str(
|
||||
|
@ -447,7 +448,7 @@ def guess_external_subtitles(dest_folder, subtitles):
|
|||
logging.debug('BAZARR detected encoding %r', guess)
|
||||
text = text.decode(guess)
|
||||
except:
|
||||
pass
|
||||
logging.debug('BAZARR was unable to detect encoding for this subtitles file: %r', subtitle_path)
|
||||
finally:
|
||||
if bool(re.search(hi_regex, text)):
|
||||
subtitles[subtitle] = Language.rebuild(subtitles[subtitle], forced=False, hi=True)
|
||||
|
|
Loading…
Reference in a new issue