aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/postprocessor
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2025-05-05 01:19:04 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2025-05-05 01:19:04 -0400
commit2486bca7db446271312f1fc0f46b032154c65f1b (patch)
tree86deb50b258b2dab02936802b79d1af7e3c254ab /gallery_dl/postprocessor
parentf98d637baa18530edb64e5f71bb9feefbd9e80b4 (diff)
parentc679cd7a13bdbf6896e53d68fe2093910bc6625a (diff)
Update upstream source from tag 'upstream/1.29.6'
Update to upstream version '1.29.6' with Debian dir fb955c7c635591b07c8b52773c233ca312089e7a
Diffstat (limited to 'gallery_dl/postprocessor')
-rw-r--r--gallery_dl/postprocessor/__init__.py1
-rw-r--r--gallery_dl/postprocessor/directory.py30
2 files changed, 31 insertions, 0 deletions
diff --git a/gallery_dl/postprocessor/__init__.py b/gallery_dl/postprocessor/__init__.py
index 7837b06..dd44a8a 100644
--- a/gallery_dl/postprocessor/__init__.py
+++ b/gallery_dl/postprocessor/__init__.py
@@ -11,6 +11,7 @@
modules = [
"classify",
"compare",
+ "directory",
"exec",
"hash",
"metadata",
diff --git a/gallery_dl/postprocessor/directory.py b/gallery_dl/postprocessor/directory.py
new file mode 100644
index 0000000..ed8c02e
--- /dev/null
+++ b/gallery_dl/postprocessor/directory.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2025 Mike Fährmann
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+
+"""Trigger directory format string evaluation"""
+
+from .common import PostProcessor
+
+
+class DirectoryPP(PostProcessor):
+
+ def __init__(self, job, options):
+ PostProcessor.__init__(self, job)
+
+ events = options.get("event")
+ if events is None:
+ events = ("prepare",)
+ elif isinstance(events, str):
+ events = events.split(",")
+ job.register_hooks({event: self.run for event in events}, options)
+
+ def run(self, pathfmt):
+ pathfmt.set_directory(pathfmt.kwdict)
+
+
+__postprocessor__ = DirectoryPP