From 552c43536066c20e7c50d35140fc41df42225150 Mon Sep 17 00:00:00 2001 From: Verte Vero Date: Wed, 14 Dec 2011 06:34:29 -0600 Subject: [PATCH 1/2] add reverse order feature --- youtube-dl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/youtube-dl b/youtube-dl index 6a6033491..f50805540 100755 --- a/youtube-dl +++ b/youtube-dl @@ -2547,7 +2547,12 @@ class YoutubePlaylistIE(InfoExtractor): playliststart = self._downloader.params.get('playliststart', 1) - 1 playlistend = self._downloader.params.get('playlistend', -1) + reverseorder = self._downloader.params.get('reverseorder', True) + video_ids = video_ids[playliststart:playlistend] + + if reverseorder: + video_ids.reverse() for id in video_ids: self._youtube_ie.extract('http://www.youtube.com/watch?v=%s' % id) @@ -2629,6 +2634,7 @@ class YoutubeUserIE(InfoExtractor): all_ids_count = len(video_ids) playliststart = self._downloader.params.get('playliststart', 1) - 1 playlistend = self._downloader.params.get('playlistend', -1) + reverseorder = self._downloader.params.get('reverseorder', True) if playlistend == -1: video_ids = video_ids[playliststart:] @@ -2637,6 +2643,9 @@ class YoutubeUserIE(InfoExtractor): self._downloader.to_screen("[youtube] user %s: Collected %d video ids (downloading %d of them)" % (username, all_ids_count, len(video_ids))) + + if reverseorder: + video_ids.reverse() for video_id in video_ids: self._youtube_ie.extract('http://www.youtube.com/watch?v=%s' % video_id) @@ -4161,7 +4170,8 @@ def parseOpts(): dest='playliststart', metavar='NUMBER', help='playlist video to start at (default is 1)', default=1) selection.add_option('--playlist-end', dest='playlistend', metavar='NUMBER', help='playlist video to end at (default is last)', default=-1) - selection.add_option('--match-title', dest='matchtitle', metavar='REGEX',help='download only matching titles (regex or caseless sub-string)') + selection.add_option('--reverse-order', action='store_true', dest='reverseorder', help='reverse download order for user pages/playlists', default=False) + selection.add_option('--match-title', action='store_true', dest='matchtitle', metavar='REGEX', help='download only matching titles (regex or caseless sub-string)') selection.add_option('--reject-title', dest='rejecttitle', metavar='REGEX',help='skip download for matching titles (regex or caseless sub-string)') selection.add_option('--max-downloads', metavar='NUMBER', dest='max_downloads', help='Abort after downloading NUMBER files', default=None) From 8a9b79aba1088c3c8d29d9cf8995533ed6694a1d Mon Sep 17 00:00:00 2001 From: Verte Vero Date: Wed, 14 Dec 2011 06:38:34 -0600 Subject: [PATCH 2/2] add reverse order feature --- youtube-dl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube-dl b/youtube-dl index f50805540..b90ac47eb 100755 --- a/youtube-dl +++ b/youtube-dl @@ -4171,7 +4171,7 @@ def parseOpts(): selection.add_option('--playlist-end', dest='playlistend', metavar='NUMBER', help='playlist video to end at (default is last)', default=-1) selection.add_option('--reverse-order', action='store_true', dest='reverseorder', help='reverse download order for user pages/playlists', default=False) - selection.add_option('--match-title', action='store_true', dest='matchtitle', metavar='REGEX', help='download only matching titles (regex or caseless sub-string)') + selection.add_option('--match-title', dest='matchtitle', metavar='REGEX',help='download only matching titles (regex or caseless sub-string)') selection.add_option('--reject-title', dest='rejecttitle', metavar='REGEX',help='skip download for matching titles (regex or caseless sub-string)') selection.add_option('--max-downloads', metavar='NUMBER', dest='max_downloads', help='Abort after downloading NUMBER files', default=None)