Add title and id to playlist results

Not all IE give both. They are not used yet.
This commit is contained in:
Jaime Marquínez Ferrándiz 2013-03-28 13:39:00 +01:00
parent cfa90f4adc
commit d2c690828a

View file

@ -147,10 +147,14 @@ class InfoExtractor(object):
video_info = {'_type': 'url', video_info = {'_type': 'url',
'url': url} 'url': url}
return video_info return video_info
def playlist_result(self, entries): def playlist_result(self, entries, playlist_id=None, playlist_title=None):
"""Returns a playlist""" """Returns a playlist"""
video_info = {'_type': 'playlist', video_info = {'_type': 'playlist',
'entries': entries} 'entries': entries}
if playlist_id:
video_info['id'] = playlist_id
if playlist_title:
video_info['title'] = playlist_title
return video_info return video_info
@ -1808,7 +1812,7 @@ class YoutubePlaylistIE(InfoExtractor):
self._downloader.to_screen(u'[youtube] PL %s: Found %i videos, downloading %i' % (playlist_id, total, len(videos))) self._downloader.to_screen(u'[youtube] PL %s: Found %i videos, downloading %i' % (playlist_id, total, len(videos)))
url_results = [self.url_result(url) for url in videos] url_results = [self.url_result(url) for url in videos]
return [self.playlist_result(url_results)] return [self.playlist_result(url_results, playlist_id)]
class YoutubeChannelIE(InfoExtractor): class YoutubeChannelIE(InfoExtractor):
@ -1860,7 +1864,7 @@ class YoutubeChannelIE(InfoExtractor):
urls = ['http://www.youtube.com/watch?v=%s' % id for id in video_ids] urls = ['http://www.youtube.com/watch?v=%s' % id for id in video_ids]
url_entries = [self.url_result(url) for url in urls] url_entries = [self.url_result(url) for url in urls]
return [self.playlist_result(url_entries)] return [self.playlist_result(url_entries, channel_id)]
class YoutubeUserIE(InfoExtractor): class YoutubeUserIE(InfoExtractor):
@ -1944,7 +1948,7 @@ class YoutubeUserIE(InfoExtractor):
urls = ['http://www.youtube.com/watch?v=%s' % video_id for video_id in video_ids] urls = ['http://www.youtube.com/watch?v=%s' % video_id for video_id in video_ids]
url_results = [self.url_result(url) for url in urls] url_results = [self.url_result(url) for url in urls]
return [self.playlist_result(url_results)] return [self.playlist_result(url_results, playlist_title = username)]
class BlipTVUserIE(InfoExtractor): class BlipTVUserIE(InfoExtractor):
@ -2036,7 +2040,7 @@ class BlipTVUserIE(InfoExtractor):
urls = [u'http://blip.tv/%s' % video_id for video_id in video_ids] urls = [u'http://blip.tv/%s' % video_id for video_id in video_ids]
url_entries = [self.url_result(url) for url in urls] url_entries = [self.url_result(url) for url in urls]
return [self.playlist_result(url_entries)] return [self.playlist_result(url_entries, playlist_title = username)]
class DepositFilesIE(InfoExtractor): class DepositFilesIE(InfoExtractor):