From 6623ac349b41d044ceaddf3083d1d74ce1373029 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Mon, 4 Jan 2021 23:15:15 +0530 Subject: [PATCH] Added negative switches for many existing options * The idea is that it should be possible to negate any boolean option by adding a `no-` to the switch New: `--no-ignore-dynamic-mpd`, `--no-allow-dynamic-mpd`, `--allow-dynamic-mpd`, `--youtube-include-hls-manifest`, `--no-youtube-include-hls-manifest`, `--no-youtube-skip-hls-manifest`, `--no-download`, `--no-download-archive`, `--resize-buffer`, `--part`, `--mtime`, `--no-keep-fragments`, `--no-cookies`, `--no-write-annotations`, `--no-write-info-json`, `--no-write-description`, `--no-write-thumbnail`, `--youtube-include-dash-manifest`, `--post-overwrites`, `--no-keep-video`, `--no-embed-subs`, `--no-embed-thumbnail`, `--no-add-metadata`, `--no-include-ads`, `--no-write-sub`, `--no-write-auto-sub`, `--no-playlist-reverse`, `--no-restrict-filenames`, `--youtube-include-dash-manifest`, `--no-format-sort-force`, `--flat-videos`, `--no-list-formats-as-table`, `--no-sponskrub`, `--no-sponskrub-cut`, `--no-sponskrub-force` Renamed: `--write-subs`, --no-write-subs`, `--no-write-auto-subs, `--write-auto-subs`. Note that these can still be used without the ending "s" --- README.md | 160 +++++++++++++++--------- youtube_dlc/options.py | 268 +++++++++++++++++++++++++++++------------ 2 files changed, 295 insertions(+), 133 deletions(-) diff --git a/README.md b/README.md index 20d801555..9667603c6 100644 --- a/README.md +++ b/README.md @@ -97,14 +97,16 @@ # DESCRIPTION # OPTIONS -h, --help Print this help text and exit --version Print program version and exit - -U, --update Update this program to latest version. Make + -U, --update (Doesn't work since there is no release) + Update this program to latest version. Make sure that you have sufficient permissions (run with sudo if needed) + -i, --ignore-errors Continue on download errors, for example to skip unavailable videos in a playlist - --abort-on-error Abort downloading of further videos (in the - playlist or the command line) if an error - occurs + (Same as --no-abort-on-error) + --abort-on-error Abort downloading of further videos if an + error occurs (Same as --no-ignore-errors) --dump-user-agent Display the current browser identification --list-extractors List all supported extractors --extractor-descriptions Output descriptions of all supported @@ -113,24 +115,26 @@ # OPTIONS extractor --default-search PREFIX Use this prefix for unqualified URLs. For example "gvsearch2:" downloads two videos - from google videos for youtube-dlc "large + from google videos for youtube-dl "large apple". Use the value "auto" to let - youtube-dlc guess ("auto_warning" to emit a + youtube-dl guess ("auto_warning" to emit a warning when guessing). "error" just throws an error. The default value "fixup_error" repairs broken URLs, but emits an error if this is not possible instead of searching. - --ignore-config Do not read configuration files. When given + --ignore-config, --no-config Do not read configuration files. When given in the global configuration file - /etc/youtube-dlc.conf: Do not read the user + /etc/youtube-dl.conf: Do not read the user configuration in ~/.config/youtube- - dlc/config (%APPDATA%/youtube- - dlc/config.txt on Windows) + dl/config (%APPDATA%/youtube-dl/config.txt + on Windows) --config-location PATH Location of the configuration file; either the path to the config or its containing directory. --flat-playlist Do not extract the videos of a playlist, only list them. + --flat-videos Do not resolve the video urls + --no-flat-playlist Extract the videos of a playlist --mark-watched Mark videos watched (YouTube only) --no-mark-watched Do not mark videos watched (YouTube only) --no-color Do not emit color codes in output @@ -183,11 +187,15 @@ ## Video Selection: SIZE (e.g. 50k or 44.6m) --max-filesize SIZE Do not download any videos larger than SIZE (e.g. 50k or 44.6m) - --date DATE Download only videos uploaded in this date + --date DATE Download only videos uploaded in this date. + The date can be "YYYYMMDD" or in the format + "(now|today)[+-][0-9](day|week|month|year)(s)?" --datebefore DATE Download only videos uploaded on or before - this date (i.e. inclusive) + this date (i.e. inclusive). The date formats + accepted is the same as --date --dateafter DATE Download only videos uploaded on or after - this date (i.e. inclusive) + this date (i.e. inclusive). The date formats + accepted is the same as --date --min-views COUNT Do not download any videos with less than COUNT views --max-views COUNT Do not download any videos with more than @@ -211,6 +219,7 @@ ## Video Selection: service), but who also have a description, use --match-filter "like_count > 100 & dislike_count 100 & dislike_count 100 & dislike_count .+?) - (?P.+)"') + help=( + 'Parse additional metadata like song title / artist from the video title. ' + 'The format syntax is the same as --output. Regular expression with ' + 'named capture groups may also be used. ' + 'The parsed parameters replace existing values. ' + 'Example: --metadata-from-title "%(artist)s - %(title)s" matches a title like ' + '"Coldplay - Paradise". ' + 'Example (regex): --metadata-from-title "(?P<artist>.+?) - (?P<title>.+)"')) postproc.add_option( '--xattrs', action='store_true', dest='xattrs', default=False, @@ -922,15 +1023,16 @@ def _comma_separated_values_options_callback(option, opt_str, value, parser): postproc.add_option( '--fixup', metavar='POLICY', dest='fixup', default='detect_or_warn', - help='Automatically correct known faults of the file. ' - 'One of never (do nothing), warn (only emit a warning), ' - 'detect_or_warn (the default; fix file if we can, warn otherwise)') + help=( + 'Automatically correct known faults of the file. ' + 'One of never (do nothing), warn (only emit a warning), ' + 'detect_or_warn (the default; fix file if we can, warn otherwise)')) postproc.add_option( - '--prefer-avconv', + '--prefer-avconv', '--no-prefer-ffmpeg', action='store_false', dest='prefer_ffmpeg', help='Prefer avconv over ffmpeg for running the postprocessors') postproc.add_option( - '--prefer-ffmpeg', + '--prefer-ffmpeg', '--no-prefer-avconv', action='store_true', dest='prefer_ffmpeg', help='Prefer ffmpeg over avconv for running the postprocessors (default)') postproc.add_option( @@ -950,19 +1052,29 @@ def _comma_separated_values_options_callback(option, opt_str, value, parser): extractor.add_option( '--sponskrub', action='store_true', dest='sponskrub', default=None, - help='Use sponskrub to mark sponsored sections with the data available in SponsorBlock API (Youtube only)') + help=( + 'Use sponskrub to mark sponsored sections with the data available in SponsorBlock API. ' + 'This is enabled by default if the sponskrub binary exists (Youtube only)')) extractor.add_option( '--no-sponskrub', action='store_false', dest='sponskrub', - help=optparse.SUPPRESS_HELP) + help='Do not use sponskrub') extractor.add_option( '--sponskrub-cut', default=False, action='store_true', dest='sponskrub_cut', help='Cut out the sponsor sections instead of simply marking them') + extractor.add_option( + '--no-sponskrub-cut', + action='store_false', dest='sponskrub_cut', + help='Simply mark the sponsor sections, not cut them out (default)') extractor.add_option( '--sponskrub-force', default=False, action='store_true', dest='sponskrub_force', help='Run sponskrub even if the video was already downloaded') + extractor.add_option( + '--no-sponskrub-force', + action='store_true', dest='sponskrub_force', + help='Do not cut out the sponsor sections if the video was already downloaded (default)') extractor.add_option( '--sponskrub-location', metavar='PATH', dest='sponskrub_path', default='', @@ -973,11 +1085,11 @@ def _comma_separated_values_options_callback(option, opt_str, value, parser): extractor = optparse.OptionGroup(parser, 'Extractor Options') extractor.add_option( - '--allow-dynamic-mpd', + '--allow-dynamic-mpd', '--no-ignore-dynamic-mpd', action='store_true', dest='dynamic_mpd', default=True, - help=optparse.SUPPRESS_HELP) + help='Process dynamic DASH manifests (default)') extractor.add_option( - '--ignore-dynamic-mpd', + '--ignore-dynamic-mpd', '--no-allow-dynamic-mpd', action='store_false', dest='dynamic_mpd', help='Do not process dynamic DASH manifests')