diff options
author | Sergey M․ <dstftw@gmail.com> | 2016-10-09 01:02:35 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2016-10-09 01:02:35 +0700 |
commit | f68901e50a9286aa4d82348cac0e85e26359c81c (patch) | |
tree | 8354262bc44e410100afad720829180a06ee06a8 /youtube_dl/extractor/reverbnation.py | |
parent | 3adb9d119e049d2bbc92fe2b56f1a22f4a664892 (diff) |
[reverbnation] Eliminate code duplication in thumbnails extraction
Diffstat (limited to 'youtube_dl/extractor/reverbnation.py')
-rw-r--r-- | youtube_dl/extractor/reverbnation.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/youtube_dl/extractor/reverbnation.py b/youtube_dl/extractor/reverbnation.py index 52f18e231..4875009e5 100644 --- a/youtube_dl/extractor/reverbnation.py +++ b/youtube_dl/extractor/reverbnation.py @@ -1,7 +1,10 @@ from __future__ import unicode_literals from .common import InfoExtractor -from ..utils import str_or_none +from ..utils import ( + qualities, + str_or_none, +) class ReverbNationIE(InfoExtractor): @@ -28,16 +31,15 @@ class ReverbNationIE(InfoExtractor): note='Downloading information of song %s' % song_id ) + THUMBNAILS = ('thumbnail', 'image') + quality = qualities(THUMBNAILS) thumbnails = [] - if api_res.get('image'): - thumbnails.append({ - 'url': api_res.get('image'), - }) - if api_res.get('thumbnail'): - thumbnails.append({ - 'url': api_res.get('thumbnail'), - 'preference': -2, - }) + for thumb_key in THUMBNAILS: + if api_res.get(thumb_key): + thumbnails.append({ + 'url': api_res[thumb_key], + 'preference': quality(thumb_key) + }) return { 'id': song_id, |