[addanime] Add format quality (Closes #5371)

This commit is contained in:
Sergey M․ 2015-04-07 21:00:22 +06:00
parent 29713e4268
commit beb10f843f

View file

@ -11,6 +11,7 @@ from ..compat import (
) )
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
qualities,
) )
@ -63,8 +64,10 @@ class AddAnimeIE(InfoExtractor):
note='Confirming after redirect') note='Confirming after redirect')
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
FORMATS = ('normal', 'hq')
quality = qualities(FORMATS)
formats = [] formats = []
for format_id in ('normal', 'hq'): for format_id in FORMATS:
rex = r"var %s_video_file = '(.*?)';" % re.escape(format_id) rex = r"var %s_video_file = '(.*?)';" % re.escape(format_id)
video_url = self._search_regex(rex, webpage, 'video file URLx', video_url = self._search_regex(rex, webpage, 'video file URLx',
fatal=False) fatal=False)
@ -73,6 +76,7 @@ class AddAnimeIE(InfoExtractor):
formats.append({ formats.append({
'format_id': format_id, 'format_id': format_id,
'url': video_url, 'url': video_url,
'quality': quality(format_id),
}) })
self._sort_formats(formats) self._sort_formats(formats)
video_title = self._og_search_title(webpage) video_title = self._og_search_title(webpage)