1
0
Fork 0
mirror of https://github.com/blackjack4494/yt-dlc.git synced 2024-12-22 15:57:23 +00:00

Reworked Vimeo file selection logic (quality, codec) - closes #530

This commit is contained in:
Filippo Valsorda 2012-11-13 21:53:18 +01:00
parent 0526e4f55a
commit 74033a662d

View file

@ -1100,21 +1100,32 @@ class VimeoIE(InfoExtractor):
timestamp = config['request']['timestamp'] timestamp = config['request']['timestamp']
# Vimeo specific: extract video codec and quality information # Vimeo specific: extract video codec and quality information
# First consider quality, then codecs, then take everything
# TODO bind to format param # TODO bind to format param
codecs = [('h264', 'mp4'), ('vp8', 'flv'), ('vp6', 'flv')] codecs = [('h264', 'mp4'), ('vp8', 'flv'), ('vp6', 'flv')]
for codec in codecs: files = { 'hd': [], 'sd': [], 'other': []}
if codec[0] in config["video"]["files"]: for codec_name, codec_extension in codecs:
video_codec = codec[0] if codec_name in config["video"]["files"]:
video_extension = codec[1] if 'hd' in config["video"]["files"][codec_name]:
if 'hd' in config["video"]["files"][codec[0]]: quality = 'hd' files['hd'].append((codec_name, codec_extension, 'hd'))
else: quality = 'sd' elif 'sd' in config["video"]["files"][codec_name]:
files['sd'].append((codec_name, codec_extension, 'sd'))
else:
files['other'].append((codec_name, codec_extension, config["video"]["files"][codec_name][0]))
for quality in ('hd', 'sd', 'other'):
if len(files[quality]) > 0:
video_quality = files[quality][0][2]
video_codec = files[quality][0][0]
video_extension = files[quality][0][1]
self._downloader.to_screen(u'[vimeo] %s: Downloading %s file at %s quality' % (video_id, video_codec.upper(), video_quality))
break break
else: else:
self._downloader.trouble(u'ERROR: no known codec found') self._downloader.trouble(u'ERROR: no known codec found')
return return
video_url = "http://player.vimeo.com/play_redirect?clip_id=%s&sig=%s&time=%s&quality=%s&codecs=%s&type=moogaloop_local&embed_location=" \ video_url = "http://player.vimeo.com/play_redirect?clip_id=%s&sig=%s&time=%s&quality=%s&codecs=%s&type=moogaloop_local&embed_location=" \
%(video_id, sig, timestamp, quality, video_codec.upper()) %(video_id, sig, timestamp, video_quality, video_codec.upper())
return [{ return [{
'id': video_id, 'id': video_id,