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'
|
info['error'] = 'badfile'
|
||||||
else:
|
else:
|
||||||
for key in ('duration', 'size', 'bit_rate'):
|
for key in ('duration', 'size', 'bit_rate'):
|
||||||
info[{
|
if key in ffinfo['format']:
|
||||||
'bit_rate': 'bitrate'
|
info[{
|
||||||
}.get(key, key)] = fix_value(key, ffinfo['format'][key])
|
'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['audio'] = []
|
||||||
info['video'] = []
|
info['video'] = []
|
||||||
info['metadata'] = ffinfo['format'].get('tags', {})
|
info['metadata'] = ffinfo['format'].get('tags', {})
|
||||||
|
|
Loading…
Reference in a new issue