aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/options.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-06-17 10:18:21 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-06-17 10:36:52 +0530
commit7e88d7d78f452ea69f06bbdf23f82e9ad7c3de5e (patch)
tree368974f9939f111ddb274adaad03ac88d782fa92 /yt_dlp/options.py
parentf0c9fb96827ff798a48626e7e5d32a9c5de7b97e (diff)
downloadhypervideo-pre-7e88d7d78f452ea69f06bbdf23f82e9ad7c3de5e.tar.lz
hypervideo-pre-7e88d7d78f452ea69f06bbdf23f82e9ad7c3de5e.tar.xz
hypervideo-pre-7e88d7d78f452ea69f06bbdf23f82e9ad7c3de5e.zip
Add slicing notation to `--playlist-items`
* Adds support for negative indices and step * Add `-I` as alias for `--playlist-index` * Deprecates `--playlist-start`, `--playlist-end`, `--playlist-reverse`, `--no-playlist-reverse` Closes #2951, Closes #2853
Diffstat (limited to 'yt_dlp/options.py')
-rw-r--r--yt_dlp/options.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/yt_dlp/options.py b/yt_dlp/options.py
index 91e7c1f82..bc646ab4a 100644
--- a/yt_dlp/options.py
+++ b/yt_dlp/options.py
@@ -500,15 +500,19 @@ def create_parser():
selection.add_option(
'--playlist-start',
dest='playliststart', metavar='NUMBER', default=1, type=int,
- help='Playlist video to start at (default is %default)')
+ help=optparse.SUPPRESS_HELP)
selection.add_option(
'--playlist-end',
dest='playlistend', metavar='NUMBER', default=None, type=int,
- help='Playlist video to end at (default is last)')
+ help=optparse.SUPPRESS_HELP)
selection.add_option(
- '--playlist-items',
+ '-I', '--playlist-items',
dest='playlist_items', metavar='ITEM_SPEC', default=None,
- help='Playlist video items to download. Specify indices of the videos in the playlist separated by commas like: "--playlist-items 1,2,5,8" if you want to download videos indexed 1, 2, 5, 8 in the playlist. You can specify range: "--playlist-items 1-3,7,10-13", it will download the videos at index 1, 2, 3, 7, 10, 11, 12 and 13')
+ help=(
+ 'Comma seperated playlist_index of the videos to download. '
+ 'You can specify a range using "[START]:[STOP][:STEP]". For backward compatibility, START-STOP is also supported. '
+ 'Use negative indices to count from the right and negative STEP to download in reverse order. '
+ 'Eg: "-I 1:3,7,-5::2" used on a playlist of size 15 will download the videos at index 1,2,3,7,11,13,15'))
selection.add_option(
'--match-title',
dest='matchtitle', metavar='REGEX',
@@ -885,11 +889,11 @@ def create_parser():
downloader.add_option(
'--playlist-reverse',
action='store_true',
- help='Download playlist videos in reverse order')
+ help=optparse.SUPPRESS_HELP)
downloader.add_option(
'--no-playlist-reverse',
action='store_false', dest='playlist_reverse',
- help='Download playlist videos in default order (default)')
+ help=optparse.SUPPRESS_HELP)
downloader.add_option(
'--playlist-random',
action='store_true',