Fix for non UTF8 file system encoding.

pull/427/head
Louis Vézina 6 years ago
parent 8a21265fe6
commit 9064583853

@ -2,6 +2,7 @@ import enzyme
import logging
import os
import subprocess
import locale
from utils import get_binary
@ -18,7 +19,7 @@ class EmbeddedSubsReader:
def list_languages(self, file):
if self.ffprobe:
try:
return subprocess.check_output([self.ffprobe, "-loglevel", "error", "-select_streams", "s", "-show_entries", "stream_tags=language", "-of", "csv=p=0", file], universal_newlines=True, stderr=subprocess.STDOUT).strip().split("\n")
return subprocess.check_output([self.ffprobe, "-loglevel", "error", "-select_streams", "s", "-show_entries", "stream_tags=language", "-of", "csv=p=0", file.encode(locale.getpreferredencoding())], universal_newlines=True, stderr=subprocess.STDOUT).strip().split("\n")
except subprocess.CalledProcessError as e:
raise FFprobeError(e.output)
if os.path.splitext(file)[1] != '.mkv':

Loading…
Cancel
Save