projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3adb9d1
)
[reverbnation] Eliminate code duplication in thumbnails extraction
author
Sergey M․
<dstftw@gmail.com>
Sat, 8 Oct 2016 18:02:35 +0000
(
01:02
+0700)
committer
Sergey M․
<dstftw@gmail.com>
Sat, 8 Oct 2016 18:02:35 +0000
(
01:02
+0700)
youtube_dl/extractor/reverbnation.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/reverbnation.py
b/youtube_dl/extractor/reverbnation.py
index 52f18e2319ca9b4de1913318181d96349b316575..4875009e5cafd68867b67393d36d90625e5f29c8 100644
(file)
--- 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 __future__ import unicode_literals
from .common import InfoExtractor
-from ..utils import str_or_none
+from ..utils import (
+ qualities,
+ str_or_none,
+)
class ReverbNationIE(InfoExtractor):
class ReverbNationIE(InfoExtractor):
@@
-28,16
+31,15
@@
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'):
- 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,
return {
'id': song_id,