From fa29557a6fad0af4d6b0a0b0a00f3c43d1107668 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 18 Dec 2015 15:46:01 +0100 Subject: [PATCH] ignore audio language if stream length does not match --- ox/file.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ox/file.py b/ox/file.py index 7be0910..9c9955e 100644 --- a/ox/file.py +++ b/ox/file.py @@ -190,10 +190,11 @@ def avinfo(filename, cached=True): p = subprocess.Popen([ffmpeg, '-i', filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() languages = [re.compile('\((.+?)\):').findall(l) for l in stderr.split('\n') if 'Stream' in l and 'Audio' in l] - for i, stream in enumerate(info['audio']): - language = languages[i] - if language and language[0] != 'und': - stream['language'] = language[0] + if len(languages) == len(info['audio']): + for i, stream in enumerate(info['audio']): + language = languages[i] + if language and language[0] != 'und': + stream['language'] = language[0] return info return {'path': filename, 'size': 0}