diff options
Diffstat (limited to 'gallery_dl/postprocessor/metadata.py')
| -rw-r--r-- | gallery_dl/postprocessor/metadata.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gallery_dl/postprocessor/metadata.py b/gallery_dl/postprocessor/metadata.py index fe65c88..e776888 100644 --- a/gallery_dl/postprocessor/metadata.py +++ b/gallery_dl/postprocessor/metadata.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2019-2021 Mike Fährmann +# Copyright 2019-2022 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 @@ -59,6 +59,8 @@ class MetadataPP(PostProcessor): events = events.split(",") job.register_hooks({event: self.run for event in events}, options) + self.mtime = options.get("mtime") + def run(self, pathfmt): directory = self._directory(pathfmt) path = directory + self._filename(pathfmt) @@ -71,6 +73,11 @@ class MetadataPP(PostProcessor): with open(path, "w", encoding="utf-8") as fp: self.write(fp, pathfmt.kwdict) + if self.mtime: + mtime = pathfmt.kwdict.get("_mtime") + if mtime: + util.set_mtime(path, mtime) + def _directory(self, pathfmt): return pathfmt.realdirectory |
