[ytdl] add 'deprecations' option
https://github.com/gdl-org/builds/issues/3
This commit is contained in:
@@ -5824,6 +5824,16 @@ Description
|
|||||||
Location of a |ytdl| configuration file to load options from.
|
Location of a |ytdl| configuration file to load options from.
|
||||||
|
|
||||||
|
|
||||||
|
extractor.ytdl.deprecations
|
||||||
|
---------------------------
|
||||||
|
Type
|
||||||
|
´´bool´´
|
||||||
|
Default
|
||||||
|
``false``
|
||||||
|
Description
|
||||||
|
Allow |ytdl| to warn about deprecated options and features.
|
||||||
|
|
||||||
|
|
||||||
extractor.ytdl.enabled
|
extractor.ytdl.enabled
|
||||||
----------------------
|
----------------------
|
||||||
Type
|
Type
|
||||||
@@ -6351,6 +6361,16 @@ Description
|
|||||||
Location of a |ytdl| configuration file to load options from.
|
Location of a |ytdl| configuration file to load options from.
|
||||||
|
|
||||||
|
|
||||||
|
downloader.ytdl.deprecations
|
||||||
|
----------------------------
|
||||||
|
Type
|
||||||
|
´´bool´´
|
||||||
|
Default
|
||||||
|
``false``
|
||||||
|
Description
|
||||||
|
Allow |ytdl| to warn about deprecated options and features.
|
||||||
|
|
||||||
|
|
||||||
downloader.ytdl.format
|
downloader.ytdl.format
|
||||||
----------------------
|
----------------------
|
||||||
Type
|
Type
|
||||||
|
|||||||
@@ -851,6 +851,7 @@
|
|||||||
{
|
{
|
||||||
"cmdline-args": null,
|
"cmdline-args": null,
|
||||||
"config-file" : null,
|
"config-file" : null,
|
||||||
|
"deprecations": false,
|
||||||
"enabled" : false,
|
"enabled" : false,
|
||||||
"format" : null,
|
"format" : null,
|
||||||
"generic" : true,
|
"generic" : true,
|
||||||
@@ -1068,6 +1069,7 @@
|
|||||||
{
|
{
|
||||||
"cmdline-args" : null,
|
"cmdline-args" : null,
|
||||||
"config-file" : null,
|
"config-file" : null,
|
||||||
|
"deprecations" : false,
|
||||||
"enabled" : true,
|
"enabled" : true,
|
||||||
"format" : null,
|
"format" : null,
|
||||||
"forward-cookies": true,
|
"forward-cookies": true,
|
||||||
|
|||||||
@@ -26,14 +26,16 @@ def construct_YoutubeDL(module, obj, user_opts, system_opts=None):
|
|||||||
opts = argv = None
|
opts = argv = None
|
||||||
config = obj.config
|
config = obj.config
|
||||||
|
|
||||||
cfg = config("config-file")
|
if not config("deprecations"):
|
||||||
if cfg:
|
module.YoutubeDL.deprecated_feature = util.false
|
||||||
|
module.YoutubeDL.deprecation_warning = util.false
|
||||||
|
|
||||||
|
if cfg := config("config-file"):
|
||||||
with open(util.expand_path(cfg)) as fp:
|
with open(util.expand_path(cfg)) as fp:
|
||||||
contents = fp.read()
|
contents = fp.read()
|
||||||
argv = shlex.split(contents, comments=True)
|
argv = shlex.split(contents, comments=True)
|
||||||
|
|
||||||
cmd = config("cmdline-args")
|
if cmd := config("cmdline-args"):
|
||||||
if cmd:
|
|
||||||
if isinstance(cmd, str):
|
if isinstance(cmd, str):
|
||||||
cmd = shlex.split(cmd)
|
cmd = shlex.split(cmd)
|
||||||
argv = (argv + cmd) if argv else cmd
|
argv = (argv + cmd) if argv else cmd
|
||||||
@@ -54,8 +56,7 @@ def construct_YoutubeDL(module, obj, user_opts, system_opts=None):
|
|||||||
if opts.get("max_filesize") is None:
|
if opts.get("max_filesize") is None:
|
||||||
opts["max_filesize"] = text.parse_bytes(config("filesize-max"), None)
|
opts["max_filesize"] = text.parse_bytes(config("filesize-max"), None)
|
||||||
if opts.get("ratelimit") is None:
|
if opts.get("ratelimit") is None:
|
||||||
rate = config("rate")
|
if rate := config("rate"):
|
||||||
if rate:
|
|
||||||
func = util.build_selection_func(rate, 0, text.parse_bytes)
|
func = util.build_selection_func(rate, 0, text.parse_bytes)
|
||||||
if hasattr(func, "args"):
|
if hasattr(func, "args"):
|
||||||
opts["__gdl_ratelimit_func"] = func
|
opts["__gdl_ratelimit_func"] = func
|
||||||
@@ -64,8 +65,7 @@ def construct_YoutubeDL(module, obj, user_opts, system_opts=None):
|
|||||||
else:
|
else:
|
||||||
opts["ratelimit"] = None
|
opts["ratelimit"] = None
|
||||||
|
|
||||||
raw_opts = config("raw-options")
|
if raw_opts := config("raw-options"):
|
||||||
if raw_opts:
|
|
||||||
opts.update(raw_opts)
|
opts.update(raw_opts)
|
||||||
if config("logging", True):
|
if config("logging", True):
|
||||||
opts["logger"] = obj.log
|
opts["logger"] = obj.log
|
||||||
|
|||||||
Reference in New Issue
Block a user