Don't break if no audio tags. Fixes #473

This commit is contained in:
Clinton Hall 2014-07-11 06:18:49 +09:30
parent 984aeb77bc
commit 1443a81927

View file

@ -149,9 +149,15 @@ def buildCommands(file, newDir):
used_audio = 0
a_mapped = []
if audioStreams:
audio1 = [ item for item in audioStreams if item["tags"]["language"] == nzbtomedia.ALANGUAGE ]
try:
audio1 = [ item for item in audioStreams if item["tags"]["language"] == nzbtomedia.ALANGUAGE ]
except: # no language tags. Assume only 1 language.
audio1 = audioStreams
audio2 = [ item for item in audio1 if item["codec_name"] in nzbtomedia.ACODEC_ALLOW ]
audio3 = [ item for item in audioStreams if item["tags"]["language"] != nzbtomedia.ALANGUAGE ]
try:
audio3 = [ item for item in audioStreams if item["tags"]["language"] != nzbtomedia.ALANGUAGE ]
except:
audio3 = []
if audio2: # right language and codec...
map_cmd.extend(['-map', '0:' + str(audio2[0]["index"])])