[reverbnation] Eliminate code duplication in thumbnails extraction

pull/10879/head
Sergey M․ 8 years ago
parent 3adb9d119e
commit f68901e50a
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

@ -1,7 +1,10 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import str_or_none from ..utils import (
qualities,
str_or_none,
)
class ReverbNationIE(InfoExtractor): class ReverbNationIE(InfoExtractor):
@ -28,15 +31,14 @@ class ReverbNationIE(InfoExtractor):
note='Downloading information of song %s' % song_id note='Downloading information of song %s' % song_id
) )
THUMBNAILS = ('thumbnail', 'image')
quality = qualities(THUMBNAILS)
thumbnails = [] thumbnails = []
if api_res.get('image'): for thumb_key in THUMBNAILS:
thumbnails.append({ if api_res.get(thumb_key):
'url': api_res.get('image'),
})
if api_res.get('thumbnail'):
thumbnails.append({ thumbnails.append({
'url': api_res.get('thumbnail'), 'url': api_res[thumb_key],
'preference': -2, 'preference': quality(thumb_key)
}) })
return { return {

Loading…
Cancel
Save