From 8a82af3511b4379af0d239dbd01c672c17a2c46a Mon Sep 17 00:00:00 2001 From: pukkandan Date: Fri, 27 May 2022 04:36:23 +0530 Subject: [PATCH] [cleanup] Misc fixes and cleanup Closes #3780, Closes #3853, Closes #3850 --- Makefile | 2 +- README.md | 10 ++--- devscripts/make_readme.py | 18 ++++++--- devscripts/run_tests.sh | 2 +- setup.cfg | 9 ++++- yt-dlp.sh | 2 +- yt_dlp/YoutubeDL.py | 26 ++++++------ yt_dlp/compat/__init__.py | 9 ++++- yt_dlp/downloader/__init__.py | 3 +- yt_dlp/extractor/common.py | 3 +- yt_dlp/extractor/curiositystream.py | 2 +- yt_dlp/extractor/fc2.py | 13 ++---- yt_dlp/options.py | 4 +- yt_dlp/postprocessor/common.py | 5 ++- yt_dlp/postprocessor/ffmpeg.py | 18 ++++----- yt_dlp/utils.py | 61 +++++++++++++++-------------- 16 files changed, 103 insertions(+), 84 deletions(-) diff --git a/Makefile b/Makefile index f12282edc..4c16e88ad 100644 --- a/Makefile +++ b/Makefile @@ -129,7 +129,7 @@ completions/fish/yt-dlp.fish: yt_dlp/*.py yt_dlp/*/*.py devscripts/fish-completi mkdir -p completions/fish $(PYTHON) devscripts/fish-completion.py -_EXTRACTOR_FILES = $(shell find yt_dlp/extractor -iname '*.py' -and -not -iname 'lazy_extractors.py') +_EXTRACTOR_FILES = $(shell find yt_dlp/extractor -name '*.py' -and -not -name 'lazy_extractors.py') yt_dlp/extractor/lazy_extractors.py: devscripts/make_lazy_extractors.py devscripts/lazy_load_template.py $(_EXTRACTOR_FILES) $(PYTHON) devscripts/make_lazy_extractors.py $@ diff --git a/README.md b/README.md index fbbd6f3ab..89e3528cf 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ yt-dlp is a [youtube-dl](https://github.com/ytdl-org/youtube-dl) fork based on t * **Output template improvements**: Output templates can now have date-time formatting, numeric offsets, object traversal etc. See [output template](#output-template) for details. Even more advanced operations can also be done with the help of `--parse-metadata` and `--replace-in-metadata` -* **Other new options**: Many new options have been added such as `--concat-playlist`, `--print`, `--wait-for-video`, `--sleep-requests`, `--convert-thumbnails`, `--write-link`, `--force-download-archive`, `--force-overwrites`, `--break-on-reject` etc +* **Other new options**: Many new options have been added such as `--alias`, `--print`, `--concat-playlist`, `--wait-for-video`, `--retry-sleep`, `--sleep-requests`, `--convert-thumbnails`, `--force-download-archive`, `--force-overwrites`, `--break-on-reject` etc * **Improvements**: Regex and other operators in `--format`/`--match-filter`, multiple `--postprocessor-args` and `--downloader-args`, faster archive checking, more [format selection options](#format-selection), merge multi-video/audio, multiple `--config-locations`, `--exec` at different stages, etc @@ -151,7 +151,7 @@ Some of yt-dlp's default options are different from that of youtube-dl and youtu For ease of use, a few more compat options are available: -* `--compat-options all`: Use all compat options +* `--compat-options all`: Use all compat options (Do NOT use) * `--compat-options youtube-dl`: Same as `--compat-options all,-multistreams` * `--compat-options youtube-dlc`: Same as `--compat-options all,-no-live-chat,-no-youtube-channel-redirect` @@ -1003,9 +1003,9 @@ You can also fork the project on github and run your fork's [build workflow](.gi --no-remove-chapters Do not remove any chapters from the file (default) --force-keyframes-at-cuts Force keyframes around chapters when - removing/splitting them. The resulting video - may have fewer artifacts around the cuts, - but is very slow due to needing a re-encode + removing/splitting them. This is slow due to + needing a re-encode, but the resulting video + may have fewer artifacts around the cuts --no-force-keyframes-at-cuts Do not force keyframes around the chapters when cutting/splitting (default) --use-postprocessor NAME[:ARGS] diff --git a/devscripts/make_readme.py b/devscripts/make_readme.py index 15c4a7c7d..42578cb0a 100755 --- a/devscripts/make_readme.py +++ b/devscripts/make_readme.py @@ -12,6 +12,8 @@ OPTIONS_START = 'General Options:' OPTIONS_END = 'CONFIGURATION' EPILOG_START = 'See full documentation' +DISABLE_PATCH = object() + def take_section(text, start=None, end=None, *, shift=0): return text[ @@ -21,7 +23,7 @@ def take_section(text, start=None, end=None, *, shift=0): def apply_patch(text, patch): - return re.sub(*patch, text) + return text if patch[0] is DISABLE_PATCH else re.sub(*patch, text) options = take_section(sys.stdin.read(), f'\n {OPTIONS_START}', f'\n{EPILOG_START}', shift=1) @@ -38,11 +40,15 @@ PATCHES = ( rf'({delim[:-1]})? (?P