aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/option.py
diff options
context:
space:
mode:
Diffstat (limited to 'gallery_dl/option.py')
-rw-r--r--gallery_dl/option.py38
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'."),
)