diff --git a/docs/options.md b/docs/options.md index f70e766d..6d22062b 100644 --- a/docs/options.md +++ b/docs/options.md @@ -118,24 +118,24 @@ and other delegated URLs ## Post-processing Options: + -P, --postprocessor NAME Activate the specified post processor + -O, --postprocessor-option KEY=VALUE + Additional post processor options + --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 --zip Store downloaded files in a ZIP archive --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]' --ugoira FORMAT Convert Pixiv Ugoira to FORMAT using FFmpeg. Supported formats are 'webm', 'mp4', 'gif', 'vp8', 'vp9', 'vp9-lossless', 'copy'. - --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 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 "convert {} {}.png && rm {}" - --exec-after CMD Execute CMD after all files were downloaded - successfully. Example: --exec-after "cd - {_directory} && convert * ../doc.pdf" - -P, --postprocessor NAME Activate the specified post processor - -O, --postprocessor-option KEY=VALUE - Additional post processor options + --exec-after CMD Execute CMD after all files were downloaded. + Example: --exec-after "cd {_directory} && + convert * ../doc.pdf" diff --git a/gallery_dl/option.py b/gallery_dl/option.py index 209452fe..255d9f29 100644 --- a/gallery_dl/option.py +++ b/gallery_dl/option.py @@ -531,42 +531,15 @@ def build_parser(): } postprocessor = parser.add_argument_group("Post-processing Options") postprocessor.add_argument( - "--zip", - dest="postprocessors", - action="append_const", const="zip", default=[], - 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( - "--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, + "-P", "--postprocessor", + dest="postprocessors", metavar="NAME", action="append", default=[], + help="Activate the specified post processor", ) postprocessor.add_argument( - "--ugoira-conv-copy", - dest="postprocessors", nargs=0, action=UgoiraAction, const="copy", - help=argparse.SUPPRESS, + "-O", "--postprocessor-option", + dest="options_pp", metavar="KEY=VALUE", + action=PPParseAction, default={}, + help="Additional post processor options", ) postprocessor.add_argument( "--write-metadata", @@ -592,11 +565,26 @@ def build_parser(): action="append_const", const={"name": "metadata", "mode": "tags"}, 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( "--mtime", - dest="postprocessors", metavar="FORMAT", action=MtimeAction, + dest="postprocessors", metavar="NAME", action=MtimeAction, 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( "--mtime-from-date", @@ -604,6 +592,29 @@ def build_parser(): const="date|status[date]", 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( "--exec", dest="postprocessors", metavar="CMD", @@ -618,20 +629,9 @@ def build_parser(): dest="postprocessors", metavar="CMD", action=AppendCommandAction, const={ "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} " "&& 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