replace '--mtime-from-date' with a more generic '--mtime'
--mtime-from-date -> --mtime date for the same effect as before (--mtime-from-date also still works, but --help now lists only --mtime)
This commit is contained in:
@@ -128,8 +128,9 @@
|
||||
--write-metadata Write metadata to separate JSON files
|
||||
--write-info-json Write gallery metadata to a info.json file
|
||||
--write-tags Write image tags to separate text files
|
||||
--mtime-from-date Set file modification times according to 'date'
|
||||
metadata
|
||||
--mtime FORMAT Set file modification times according to
|
||||
metadata selected by FORMAT. Examples: 'date' or
|
||||
'status[date]'
|
||||
--exec CMD Execute CMD for each downloaded file. Supported
|
||||
replacement fields are {} or {_path},
|
||||
{_directory}, {_filename}. Example: --exec
|
||||
@@ -138,6 +139,5 @@
|
||||
successfully. Example: --exec-after "cd
|
||||
{_directory} && convert * ../doc.pdf"
|
||||
-P, --postprocessor NAME Activate the specified post processor
|
||||
-O, --postprocessor-option OPT
|
||||
Additional '<key>=<value>' post processor
|
||||
options
|
||||
-O, --postprocessor-option KEY=VALUE
|
||||
Additional post processor options
|
||||
|
||||
@@ -65,6 +65,15 @@ class InputfileAction(argparse.Action):
|
||||
namespace.input_files.append((value, self.const))
|
||||
|
||||
|
||||
class MtimeAction(argparse.Action):
|
||||
"""Configure mtime post processor"""
|
||||
def __call__(self, parser, namespace, value, option_string=None):
|
||||
namespace.postprocessors.append({
|
||||
"name": "mtime",
|
||||
"value": "{" + (self.const or value) + "}",
|
||||
})
|
||||
|
||||
|
||||
class Formatter(argparse.HelpFormatter):
|
||||
"""Custom HelpFormatter class to customize help output"""
|
||||
def __init__(self, prog):
|
||||
@@ -466,7 +475,7 @@ def build_parser():
|
||||
postprocessor.add_argument(
|
||||
"--zip",
|
||||
dest="postprocessors",
|
||||
action="append_const", const="zip",
|
||||
action="append_const", const="zip", default=[],
|
||||
help="Store downloaded files in a ZIP archive",
|
||||
)
|
||||
postprocessor.add_argument(
|
||||
@@ -535,11 +544,17 @@ def build_parser():
|
||||
action="append_const", const={"name": "metadata", "mode": "tags"},
|
||||
help="Write image tags to separate text files",
|
||||
)
|
||||
postprocessor.add_argument(
|
||||
"--mtime",
|
||||
dest="postprocessors", metavar="FORMAT", action=MtimeAction,
|
||||
help=("Set file modification times according to metadata "
|
||||
"selected by FORMAT. Examples: 'date' or 'status[date]'"),
|
||||
)
|
||||
postprocessor.add_argument(
|
||||
"--mtime-from-date",
|
||||
dest="postprocessors",
|
||||
action="append_const", const="mtime",
|
||||
help="Set file modification times according to 'date' metadata",
|
||||
dest="postprocessors", nargs=0, action=MtimeAction,
|
||||
const="date|status[date]",
|
||||
help=argparse.SUPPRESS,
|
||||
)
|
||||
postprocessor.add_argument(
|
||||
"--exec",
|
||||
|
||||
Reference in New Issue
Block a user