1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-26 01:27:07 +00:00

Fix for subtitles with no language code.

This commit is contained in:
Louis Vézina 2019-11-18 06:48:09 -05:00
parent af7ea850ab
commit fa7b9d74a8

View file

@ -93,7 +93,8 @@ def store_subtitles(original_path, reversed_path):
text = f.read()
try:
encoding = UnicodeDammit(text)
text = text.decode(encoding.original_encoding)
if six.PY2:
text = text.decode(encoding.original_encoding)
detected_language = langdetect.detect(text)
except Exception as e:
logging.exception(
@ -184,7 +185,8 @@ def store_subtitles_movie(original_path, reversed_path):
text = f.read()
try:
encoding = UnicodeDammit(text)
text = text.decode(encoding.original_encoding)
if six.PY2:
text = text.decode(encoding.original_encoding)
detected_language = langdetect.detect(text)
except Exception as e:
logging.exception(
@ -403,7 +405,8 @@ def guess_external_subtitles(dest_folder, subtitles):
text = f.read()
try:
encoding = UnicodeDammit(text)
text = text.decode(encoding.original_encoding)
if six.PY2:
text = text.decode(encoding.original_encoding)
detected_language = langdetect.detect(text)
except Exception as e:
logging.exception('BAZARR Error trying to detect language for this subtitles file: ' +