decode stdout

This commit is contained in:
j 2016-08-23 18:11:20 +02:00
parent f54cb4160e
commit 164a71ed51

View file

@ -168,11 +168,11 @@ def avinfo(filename, cached=True):
p = subprocess.Popen([ffmpeg2theora, '--info', filename],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, error = p.communicate()
stdout = stdout.decode('utf-8')
try:
info = json.loads(stdout)
except:
# remove metadata, can be broken
stdout = stdout.decode('utf-8')
reg = re.compile('"metadata": {.*?},', re.DOTALL)
stdout = re.sub(reg, '', stdout)
info = json.loads(stdout)
@ -214,6 +214,7 @@ def ffprobe(filename):
], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
info, error = p.communicate()
info = info.decode('utf-8')
ffinfo = json.loads(info)
def fix_value(key, value):