[ndr] use utils.qualites

This commit is contained in:
remitamine 2015-09-08 15:58:32 +01:00
parent b58a22b963
commit 376e1ad081

View File

@ -5,10 +5,11 @@
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
int_or_none, 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): class NDRBaseIE(InfoExtractor):
@ -29,7 +30,7 @@ def extract_video_info(self, playlist, video_id):
formats.append({ formats.append({
'url': src, 'url': src,
'format_id': quality, 'format_id': quality,
'preference': preferences.get(quality), 'preference': preference(quality),
}) })
elif streamType == 'httpAudio': elif streamType == 'httpAudio':
for key, f in playlist.items(): for key, f in playlist.items():
@ -51,7 +52,7 @@ def extract_video_info(self, playlist, video_id):
thumbnails = [{ thumbnails = [{
'id': thumbnail.get('quality'), 'id': thumbnail.get('quality'),
'url': thumbnail.get('src'), 'url': thumbnail.get('src'),
'preference': preferences.get(thumbnail.get('quality')) 'preference': preference(thumbnail.get('quality'))
} for thumbnail in config.get('poster').values()] } for thumbnail in config.get('poster').values()]
return { return {