From bce878a7c1678ac698ecd556b2c77a1e2f2306df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?= Date: Wed, 10 Apr 2013 14:32:03 +0200 Subject: Implement the playlist/start options in FileDownloader It makes it available for all the InfoExtractors --- youtube_dl/FileDownloader.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'youtube_dl/FileDownloader.py') diff --git a/youtube_dl/FileDownloader.py b/youtube_dl/FileDownloader.py index 58be5caee..5a5141ba5 100644 --- a/youtube_dl/FileDownloader.py +++ b/youtube_dl/FileDownloader.py @@ -485,10 +485,25 @@ class FileDownloader(object): #We process each entry in the playlist playlist = ie_result.get('title', None) or ie_result.get('id', None) self.to_screen(u'[download] Downloading playlist: %s' % playlist) - n_videos = len(ie_result['entries']) + playlist_results = [] - for i,entry in enumerate(ie_result['entries'],1): - self.to_screen(u'[download] Downloading video #%s of %s' %(i, n_videos)) + + n_all_entries = len(ie_result['entries']) + playliststart = self.params.get('playliststart', 1) - 1 + playlistend = self.params.get('playlistend', -1) + + if playlistend == -1: + entries = ie_result['entries'][playliststart:] + else: + entries = ie_result['entries'][playliststart:playlistend] + + n_entries = len(entries) + + self.to_screen(u"[%s] playlist '%s': Collected %d video ids (downloading %d of them)" % + (ie_result['extractor'], playlist, n_all_entries, n_entries)) + + for i,entry in enumerate(entries,1): + self.to_screen(u'[download] Downloading video #%s of %s' %(i, n_entries)) entry_result = self.process_ie_result(entry, False) entry_result['playlist'] = playlist #We must do the download here to correctly set the 'playlist' key -- cgit v1.2.3