ignore audio language if stream length does not match
This commit is contained in:
parent
85c1e789ba
commit
fa29557a6f
1 changed files with 5 additions and 4 deletions
|
@ -190,10 +190,11 @@ def avinfo(filename, cached=True):
|
||||||
p = subprocess.Popen([ffmpeg, '-i', filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen([ffmpeg, '-i', filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
languages = [re.compile('\((.+?)\):').findall(l) for l in stderr.split('\n') if 'Stream' in l and 'Audio' in l]
|
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']):
|
if len(languages) == len(info['audio']):
|
||||||
language = languages[i]
|
for i, stream in enumerate(info['audio']):
|
||||||
if language and language[0] != 'und':
|
language = languages[i]
|
||||||
stream['language'] = language[0]
|
if language and language[0] != 'und':
|
||||||
|
stream['language'] = language[0]
|
||||||
return info
|
return info
|
||||||
|
|
||||||
return {'path': filename, 'size': 0}
|
return {'path': filename, 'size': 0}
|
||||||
|
|
Loading…
Reference in a new issue