dont fail if files dont have all format keys
This commit is contained in:
parent
e4c51f0598
commit
dc6f25aac1
1 changed files with 7 additions and 3 deletions
10
ox/file.py
10
ox/file.py
|
@ -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', {})
|
||||
|
|
Loading…
Reference in a new issue