Fix for non UTF8 file system encoding.

This commit is contained in:
Louis Vézina 2019-05-03 09:34:08 -04:00
parent 8a21265fe6
commit 9064583853
1 changed files with 2 additions and 1 deletions

View File

@ -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':