reorder post processing options shown by --help

This commit is contained in:
Mike Fährmann
2023-11-16 17:37:15 +01:00
parent 168331d147
commit 8bf161e574
2 changed files with 61 additions and 61 deletions

View File

@@ -118,24 +118,24 @@
and other delegated URLs and other delegated URLs
## Post-processing Options: ## Post-processing Options:
--zip Store downloaded files in a ZIP archive -P, --postprocessor NAME Activate the specified post processor
--cbz Store downloaded files in a CBZ archive -O, --postprocessor-option KEY=VALUE
--ugoira FORMAT Convert Pixiv Ugoira to FORMAT using FFmpeg. Additional post processor options
Supported formats are 'webm', 'mp4', 'gif',
'vp8', 'vp9', 'vp9-lossless', 'copy'.
--write-metadata Write metadata to separate JSON files --write-metadata Write metadata to separate JSON files
--write-info-json Write gallery metadata to a info.json file --write-info-json Write gallery metadata to a info.json file
--write-tags Write image tags to separate text files --write-tags Write image tags to separate text files
--mtime FORMAT Set file modification times according to --zip Store downloaded files in a ZIP archive
metadata selected by FORMAT. Examples: 'date' or --cbz Store downloaded files in a CBZ archive
--mtime NAME Set file modification times according to
metadata selected by NAME. Examples: 'date' or
'status[date]' 'status[date]'
--ugoira FORMAT Convert Pixiv Ugoira to FORMAT using FFmpeg.
Supported formats are 'webm', 'mp4', 'gif',
'vp8', 'vp9', 'vp9-lossless', 'copy'.
--exec CMD Execute CMD for each downloaded file. Supported --exec CMD Execute CMD for each downloaded file. Supported
replacement fields are {} or {_path}, replacement fields are {} or {_path},
{_directory}, {_filename}. Example: --exec {_directory}, {_filename}. Example: --exec
"convert {} {}.png && rm {}" "convert {} {}.png && rm {}"
--exec-after CMD Execute CMD after all files were downloaded --exec-after CMD Execute CMD after all files were downloaded.
successfully. Example: --exec-after "cd Example: --exec-after "cd {_directory} &&
{_directory} && convert * ../doc.pdf" convert * ../doc.pdf"
-P, --postprocessor NAME Activate the specified post processor
-O, --postprocessor-option KEY=VALUE
Additional post processor options

View File

@@ -531,42 +531,15 @@ def build_parser():
} }
postprocessor = parser.add_argument_group("Post-processing Options") postprocessor = parser.add_argument_group("Post-processing Options")
postprocessor.add_argument( postprocessor.add_argument(
"--zip", "-P", "--postprocessor",
dest="postprocessors", dest="postprocessors", metavar="NAME", action="append", default=[],
action="append_const", const="zip", default=[], help="Activate the specified post processor",
help="Store downloaded files in a ZIP archive",
) )
postprocessor.add_argument( postprocessor.add_argument(
"--cbz", "-O", "--postprocessor-option",
dest="postprocessors", dest="options_pp", metavar="KEY=VALUE",
action="append_const", const={ action=PPParseAction, default={},
"name" : "zip", help="Additional post processor options",
"extension": "cbz",
},
help="Store downloaded files in a CBZ archive",
)
postprocessor.add_argument(
"--ugoira",
dest="postprocessors", metavar="FORMAT", action=UgoiraAction,
help=("Convert Pixiv Ugoira to FORMAT using FFmpeg. "
"Supported formats are 'webm', 'mp4', 'gif', "
"'vp8', 'vp9', 'vp9-lossless', 'copy'."),
)
postprocessor.add_argument(
"--ugoira-conv",
dest="postprocessors", nargs=0, action=UgoiraAction, const="vp8",
help=argparse.SUPPRESS,
)
postprocessor.add_argument(
"--ugoira-conv-lossless",
dest="postprocessors", nargs=0, action=UgoiraAction,
const="vp9-lossless",
help=argparse.SUPPRESS,
)
postprocessor.add_argument(
"--ugoira-conv-copy",
dest="postprocessors", nargs=0, action=UgoiraAction, const="copy",
help=argparse.SUPPRESS,
) )
postprocessor.add_argument( postprocessor.add_argument(
"--write-metadata", "--write-metadata",
@@ -592,11 +565,26 @@ def build_parser():
action="append_const", const={"name": "metadata", "mode": "tags"}, action="append_const", const={"name": "metadata", "mode": "tags"},
help="Write image tags to separate text files", help="Write image tags to separate text files",
) )
postprocessor.add_argument(
"--zip",
dest="postprocessors",
action="append_const", const="zip",
help="Store downloaded files in a ZIP archive",
)
postprocessor.add_argument(
"--cbz",
dest="postprocessors",
action="append_const", const={
"name" : "zip",
"extension": "cbz",
},
help="Store downloaded files in a CBZ archive",
)
postprocessor.add_argument( postprocessor.add_argument(
"--mtime", "--mtime",
dest="postprocessors", metavar="FORMAT", action=MtimeAction, dest="postprocessors", metavar="NAME", action=MtimeAction,
help=("Set file modification times according to metadata " help=("Set file modification times according to metadata "
"selected by FORMAT. Examples: 'date' or 'status[date]'"), "selected by NAME. Examples: 'date' or 'status[date]'"),
) )
postprocessor.add_argument( postprocessor.add_argument(
"--mtime-from-date", "--mtime-from-date",
@@ -604,6 +592,29 @@ def build_parser():
const="date|status[date]", const="date|status[date]",
help=argparse.SUPPRESS, help=argparse.SUPPRESS,
) )
postprocessor.add_argument(
"--ugoira",
dest="postprocessors", metavar="FORMAT", action=UgoiraAction,
help=("Convert Pixiv Ugoira to FORMAT using FFmpeg. "
"Supported formats are 'webm', 'mp4', 'gif', "
"'vp8', 'vp9', 'vp9-lossless', 'copy'."),
)
postprocessor.add_argument(
"--ugoira-conv",
dest="postprocessors", nargs=0, action=UgoiraAction, const="vp8",
help=argparse.SUPPRESS,
)
postprocessor.add_argument(
"--ugoira-conv-lossless",
dest="postprocessors", nargs=0, action=UgoiraAction,
const="vp9-lossless",
help=argparse.SUPPRESS,
)
postprocessor.add_argument(
"--ugoira-conv-copy",
dest="postprocessors", nargs=0, action=UgoiraAction, const="copy",
help=argparse.SUPPRESS,
)
postprocessor.add_argument( postprocessor.add_argument(
"--exec", "--exec",
dest="postprocessors", metavar="CMD", dest="postprocessors", metavar="CMD",
@@ -618,20 +629,9 @@ def build_parser():
dest="postprocessors", metavar="CMD", dest="postprocessors", metavar="CMD",
action=AppendCommandAction, const={ action=AppendCommandAction, const={
"name": "exec", "event": "finalize"}, "name": "exec", "event": "finalize"},
help=("Execute CMD after all files were downloaded successfully. " help=("Execute CMD after all files were downloaded. "
"Example: --exec-after \"cd {_directory} " "Example: --exec-after \"cd {_directory} "
"&& convert * ../doc.pdf\""), "&& convert * ../doc.pdf\""),
) )
postprocessor.add_argument(
"-P", "--postprocessor",
dest="postprocessors", metavar="NAME", action="append",
help="Activate the specified post processor",
)
postprocessor.add_argument(
"-O", "--postprocessor-option",
dest="options_pp", metavar="KEY=VALUE",
action=PPParseAction, default={},
help="Additional post processor options",
)
return parser return parser