aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/YoutubeDL.py
diff options
context:
space:
mode:
authorThomas Christlieb <thomaschristlieb@hotmail.com>2017-01-31 10:03:31 +0100
committerThomas Christlieb <thomaschristlieb@hotmail.com>2017-01-31 10:03:31 +0100
commit75822ca7909d7f7e15694f73b05b2bf0f1fa61f3 (patch)
tree0dcf18e250e1091f5061b8259a60b9e1e6a49ed1 /youtube_dl/YoutubeDL.py
parentdadb836139f070da9364439bf3b148eec8bc0b11 (diff)
New parameter --playlist-random to randomize playlist download order. Fixes #11889
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rwxr-xr-xyoutube_dl/YoutubeDL.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index c71e94518..a7bf5a1b0 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -24,6 +24,7 @@ import sys
import time
import tokenize
import traceback
+import random
from .compat import (
compat_basestring,
@@ -159,6 +160,7 @@ class YoutubeDL(object):
playlistend: Playlist item to end at.
playlist_items: Specific indices of playlist to download.
playlistreverse: Download playlist items in reverse order.
+ playlistrandom: Download playlist items in random order.
matchtitle: Download only matching titles.
rejecttitle: Reject downloads for matching titles.
logger: Log messages to a logging.Logger instance.
@@ -842,6 +844,9 @@ class YoutubeDL(object):
if self.params.get('playlistreverse', False):
entries = entries[::-1]
+ if self.params.get('playlistrandom', False):
+ random.shuffle(entries)
+
for i, entry in enumerate(entries, 1):
self.to_screen('[download] Downloading video %s of %s' % (i, n_entries))
extra = {