aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/postprocessor/metadata.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2025-04-15 05:25:44 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2025-04-15 05:25:44 -0400
commit71c4f9dc93d81a2733a8ec8fe177e3db0e37d33b (patch)
tree284174b9244e04f24ef1fadc5a8ef6980e7b5559 /gallery_dl/postprocessor/metadata.py
parentf13f90dc9ba67ad4a4a2b7a94d175186900b7d38 (diff)
parentb830dc03b3b7c9dd119648e1be9c1145d56e096c (diff)
Update upstream source from tag 'upstream/1.29.4'
Update to upstream version '1.29.4' with Debian dir a15c4baddb14f9fd81eb2888aeeba8d3406c73f4
Diffstat (limited to 'gallery_dl/postprocessor/metadata.py')
-rw-r--r--gallery_dl/postprocessor/metadata.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/gallery_dl/postprocessor/metadata.py b/gallery_dl/postprocessor/metadata.py
index 3ef9fbc..fbb3fb8 100644
--- a/gallery_dl/postprocessor/metadata.py
+++ b/gallery_dl/postprocessor/metadata.py
@@ -108,6 +108,7 @@ class MetadataPP(PostProcessor):
self.omode = options.get("open", omode)
self.encoding = options.get("encoding", "utf-8")
self.skip = options.get("skip", False)
+ self.meta_path = options.get("metadata-path")
def run(self, pathfmt):
archive = self.archive
@@ -120,6 +121,9 @@ class MetadataPP(PostProcessor):
directory = self._directory(pathfmt)
path = directory + self._filename(pathfmt)
+ if self.meta_path is not None:
+ pathfmt.kwdict[self.meta_path] = path
+
if self.skip and os.path.exists(path):
return
@@ -180,7 +184,10 @@ class MetadataPP(PostProcessor):
pathfmt.directory_formatters = self._directory_formatters
pathfmt.directory_conditions = ()
segments = pathfmt.build_directory(pathfmt.kwdict)
- directory = pathfmt.clean_path(os.sep.join(segments) + os.sep)
+ if segments:
+ directory = pathfmt.clean_path(os.sep.join(segments) + os.sep)
+ else:
+ directory = "." + os.sep
return os.path.join(self._base(pathfmt), directory)
finally:
pathfmt.directory_conditions = conditions