Fix for encoding guessing of external subtitles without language code under Python 2.7.x.

pull/712/head
Louis Vézina 5 years ago
parent 0df9b70558
commit 3e7ceba61d

@ -366,8 +366,14 @@ def guess_external_subtitles(dest_folder, subtitles):
subtitle_path) subtitle_path)
continue continue
detected_language = None detected_language = None
if six.PY3:
with open(subtitle_path, 'r', errors='ignore') as f: with open(subtitle_path, 'r', errors='ignore') as f:
text = f.read() text = f.read()
else:
with open(subtitle_path, 'r') as f:
text = f.read()
try: try:
encoding = UnicodeDammit(text) encoding = UnicodeDammit(text)
if six.PY2: if six.PY2:

Loading…
Cancel
Save