diff options
| author | 2024-09-07 18:33:19 -0400 | |
|---|---|---|
| committer | 2024-09-07 18:33:19 -0400 | |
| commit | 1f3ffe32342852fd9ea9e7704022488f3a1222bd (patch) | |
| tree | cb255a091b73e96840de0f6f44b36dff1acab4b9 /gallery_dl/option.py | |
| parent | b5e56c51e491b41f9eb6a895459c185788a377e5 (diff) | |
New upstream version 1.27.4.upstream/1.27.4
Diffstat (limited to 'gallery_dl/option.py')
| -rw-r--r-- | gallery_dl/option.py | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/gallery_dl/option.py b/gallery_dl/option.py index 155cbd9..0189c0e 100644 --- a/gallery_dl/option.py +++ b/gallery_dl/option.py @@ -74,6 +74,21 @@ class MtimeAction(argparse.Action): }) +class RenameAction(argparse.Action): + """Configure rename post processors""" + def __call__(self, parser, namespace, value, option_string=None): + if self.const: + namespace.postprocessors.append({ + "name": "rename", + "to" : value, + }) + else: + namespace.postprocessors.append({ + "name": "rename", + "from": value, + }) + + class UgoiraAction(argparse.Action): """Configure ugoira post processors""" def __call__(self, parser, namespace, value, option_string=None): @@ -128,7 +143,7 @@ class UgoiraAction(argparse.Action): pp["name"] = "ugoira" pp["whitelist"] = ("pixiv", "danbooru") - namespace.options.append(((), "ugoira", True)) + namespace.options.append((("extractor",), "ugoira", True)) namespace.postprocessors.append(pp) @@ -207,7 +222,7 @@ def build_parser(): ) update = parser.add_argument_group("Update Options") - if util.EXECUTABLE or 1: + if util.EXECUTABLE: update.add_argument( "-U", "--update", dest="update", action="store_const", const="latest", @@ -526,7 +541,8 @@ def build_parser(): "domain prefixed with '/', " "keyring name prefixed with '+', " "profile prefixed with ':', and " - "container prefixed with '::' ('none' for no container)"), + "container prefixed with '::' " + "('none' for no container (default), 'all' for all containers)"), ) selection = parser.add_argument_group("Selection Options") @@ -661,9 +677,21 @@ def build_parser(): help=argparse.SUPPRESS, ) postprocessor.add_argument( + "--rename", + dest="postprocessors", metavar="FORMAT", action=RenameAction, const=0, + help=("Rename previously downloaded files from FORMAT " + "to the current filename format"), + ) + postprocessor.add_argument( + "--rename-to", + dest="postprocessors", metavar="FORMAT", action=RenameAction, const=1, + help=("Rename previously downloaded files from the current filename " + "format to FORMAT"), + ) + postprocessor.add_argument( "--ugoira", - dest="postprocessors", metavar="FORMAT", action=UgoiraAction, - help=("Convert Pixiv Ugoira to FORMAT using FFmpeg. " + dest="postprocessors", metavar="FMT", action=UgoiraAction, + help=("Convert Pixiv Ugoira to FMT using FFmpeg. " "Supported formats are 'webm', 'mp4', 'gif', " "'vp8', 'vp9', 'vp9-lossless', 'copy'."), ) |
