From 40ce505420c964fb21f399c7e3c256e02b0508b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Mon, 21 Mar 2022 10:02:29 +0100 Subject: [PATCH] [postprocessor:ugoira] add 'mtime' option (#2307) --- docs/configuration.rst | 12 +++++++++++- gallery_dl/postprocessor/ugoira.py | 7 ++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index ed682b2f..829e809e 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -3161,7 +3161,7 @@ Type Default ``false`` Description - Set modification times for generated metadata files + Set modification times of generated metadata files according to the accompanying downloaded file. Enabling this option will only have an effect @@ -3306,6 +3306,16 @@ Description to reduce an odd width/height by 1 pixel and make them even. +ugoira.mtime +------------ +Type + ``bool`` +Default + ``false`` +Description + Set modification times of generated ugoira aniomations. + + ugoira.repeat-last-frame ------------------------ Type diff --git a/gallery_dl/postprocessor/ugoira.py b/gallery_dl/postprocessor/ugoira.py index e5bdebcc..d4f80043 100644 --- a/gallery_dl/postprocessor/ugoira.py +++ b/gallery_dl/postprocessor/ugoira.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2018-2021 Mike Fährmann +# Copyright 2018-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 @@ -27,6 +27,7 @@ class UgoiraPP(PostProcessor): self.output = options.get("ffmpeg-output", True) self.delete = not options.get("keep-files", False) self.repeat = options.get("repeat-last-frame", True) + self.mtime = options.get("mtime") ffmpeg = options.get("ffmpeg-location") self.ffmpeg = util.expand_path(ffmpeg) if ffmpeg else "ffmpeg" @@ -111,6 +112,10 @@ class UgoiraPP(PostProcessor): exc.__class__.__name__, exc) pathfmt.realpath = pathfmt.temppath else: + if self.mtime: + mtime = pathfmt.kwdict.get("_mtime") + if mtime: + util.set_mtime(pathfmt.realpath, mtime) if self.delete: pathfmt.delete = True else: