dont treat coverart as video

This commit is contained in:
j 2017-05-21 11:19:43 +02:00
parent 6509cfa3e2
commit 5e84e59f95

View file

@ -19,7 +19,7 @@ __all__ = ['sha1sum', 'oshash', 'avinfo', 'makedirs', 'iexists']
EXTENSIONS = {
'audio': [
'aac', 'aif', 'aiff', 'amr',
'flac', 'm4a', 'mp3', 'oga', 'ogg', 'wav', 'wma'
'flac', 'm4a', 'mp3', 'oga', 'ogg', 'wav', 'wma', 'opus'
],
'image': [
'bmp', 'gif', 'jpeg', 'jpg', 'png', 'svg', 'webp'
@ -199,6 +199,7 @@ def avinfo(filename, cached=True):
language = languages[i]
if language and language[0] != 'und':
stream['language'] = language[0]
fix_coverart(info)
return info
return {'path': filename, 'size': 0}
@ -307,6 +308,16 @@ def ffprobe(filename):
info['path'] = filename
if 'size' not in info:
info['size'] = os.path.getsize(filename)
fix_coverart(info)
return info
def fix_coverart(info):
if info.get('video') \
and info['path'].split('.')[-1] in EXTENSIONS['audio'] \
and info['video'][0]['codec'] in EXTENSIONS['image'] + ['mjpeg']:
info['cover'] = info.pop('video')
info['video'] = []
return info
def makedirs(path):