]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[ndr] use utils.qualites
authorremitamine <remitamine@gmail.com>
Tue, 8 Sep 2015 14:58:32 +0000 (15:58 +0100)
committerremitamine <remitamine@gmail.com>
Tue, 8 Sep 2015 14:58:32 +0000 (15:58 +0100)
youtube_dl/extractor/ndr.py

index 2a73650d4b5b93fd77e8df11339a7d6879245bc1..87f3edbbeb9710482b4ae5563fd153a88bcf31b5 100644 (file)
@@ -5,10 +5,11 @@ from .common import InfoExtractor
 from ..utils import (
     ExtractorError,
     int_or_none,
+    qualities,
 )
 
 
-preferences = {'xl': 4, 'l': 3, 'm': 2, 's': 1, 'xs': 0,}
+preference = qualities(['xs', 's', 'm','l', 'xl'])
 
 
 class NDRBaseIE(InfoExtractor):
@@ -29,7 +30,7 @@ class NDRBaseIE(InfoExtractor):
                         formats.append({
                             'url': src,
                             'format_id': quality,
-                            'preference': preferences.get(quality),
+                            'preference': preference(quality),
                         })
         elif streamType == 'httpAudio':
             for key, f in playlist.items():
@@ -51,7 +52,7 @@ class NDRBaseIE(InfoExtractor):
         thumbnails = [{
             'id': thumbnail.get('quality'),
             'url': thumbnail.get('src'),
-            'preference': preferences.get(thumbnail.get('quality'))
+            'preference': preference(thumbnail.get('quality'))
         } for thumbnail in config.get('poster').values()]
 
         return {