dont fail if files dont have all format keys

This commit is contained in:
j 2015-01-22 15:31:36 +05:30
parent e4c51f0598
commit dc6f25aac1

View file

@ -226,9 +226,13 @@ def ffprobe(filename):
info['error'] = 'badfile'
else:
for key in ('duration', 'size', 'bit_rate'):
info[{
'bit_rate': 'bitrate'
}.get(key, key)] = fix_value(key, ffinfo['format'][key])
if key in ffinfo['format']:
info[{
'bit_rate': 'bitrate'
}.get(key, key)] = fix_value(key, ffinfo['format'][key])
if not 'size' in info:
info['size'] = os.stat(filename).st_size
print('no size in info', filename, ffinfo)
info['audio'] = []
info['video'] = []
info['metadata'] = ffinfo['format'].get('tags', {})