youtube-dl

Another place where youtube-dl lives on
git clone git://git.oshgnacknak.de/youtube-dl.git
Log | Files | Refs | README | LICENSE

commit ff815fe65aab83db7e11251db5eafc76504adf05
parent da3a2d8137fa89051b011d90875827504a9a9373
Author: Mark Schreiber <mark7@alumni.cmu.edu>
Date:   Thu, 10 Jul 2014 20:11:11 -0700

Download playlist items in reverse order

Series of videos are typically uploaded to YouTube playlists in
chronological order.  By default, these videos are downloaded
latest-to-earliest; this is great for seeing the latest videos in a
series, but prevents streaming video in the order that the videos were
produced.  Add an option to download videos in reverse order,
earliest-to-latest.

Conflicts:
	youtube_dl/YoutubeDL.py
	youtube_dl/__init__.py

Diffstat:
MREADME.md | 1+
Myoutube_dl/YoutubeDL.py | 4++++
Myoutube_dl/__init__.py | 1+
Myoutube_dl/options.py | 4++++
4 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -75,6 +75,7 @@ which means you can modify it, redistribute it or use it however you like. ## Video Selection: --playlist-start NUMBER playlist video to start at (default is 1) --playlist-end NUMBER playlist video to end at (default is last) + --playlist-reverse Download playlist videos in reverse order --match-title REGEX download only matching titles (regex or caseless sub-string) --reject-title REGEX skip download for matching titles (regex or diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py @@ -124,6 +124,7 @@ class YoutubeDL(object): nooverwrites: Prevent overwriting files. playliststart: Playlist item to start at. playlistend: Playlist item to end at. + playlistreverse: Download playlist items in reverse order. matchtitle: Download only matching titles. rejecttitle: Reject downloads for matching titles. logger: Log messages to a logging.Logger instance. @@ -670,6 +671,9 @@ class YoutubeDL(object): "[%s] playlist %s: Downloading %d videos" % (ie_result['extractor'], playlist, n_entries)) + if self.params.get('playlistreverse', False): + entries = entries[::-1] + for i, entry in enumerate(entries, 1): self.to_screen('[download] Downloading video #%s of %s' % (i, n_entries)) extra = { diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py @@ -249,6 +249,7 @@ def _real_main(argv=None): 'progress_with_newline': opts.progress_with_newline, 'playliststart': opts.playliststart, 'playlistend': opts.playlistend, + 'playlistreverse': opts.playlist_reverse, 'noplaylist': opts.noplaylist, 'logtostderr': opts.outtmpl == '-', 'consoletitle': opts.consoletitle, diff --git a/youtube_dl/options.py b/youtube_dl/options.py @@ -349,6 +349,10 @@ def parseOpts(overrideArguments=None): '--test', action='store_true', dest='test', default=False, help=optparse.SUPPRESS_HELP) + downloader.add_option( + '--playlist-reverse', + action='store_true', + help='Download playlist videos in reverse order') workarounds = optparse.OptionGroup(parser, 'Workarounds') workarounds.add_option(