1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-25 01:02:19 +00:00

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

View file

@ -2,6 +2,7 @@ import enzyme
import logging import logging
import os import os
import subprocess import subprocess
import locale
from utils import get_binary from utils import get_binary
@ -18,7 +19,7 @@ class EmbeddedSubsReader:
def list_languages(self, file): def list_languages(self, file):
if self.ffprobe: if self.ffprobe:
try: 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: except subprocess.CalledProcessError as e:
raise FFprobeError(e.output) raise FFprobeError(e.output)
if os.path.splitext(file)[1] != '.mkv': if os.path.splitext(file)[1] != '.mkv':