[postprocessor:ugoira] add 'mtime' option (#2307)

pull/2439/head
Mike Fährmann 3 years ago
parent 9bd27b1b8d
commit 40ce505420
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -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

@ -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:

Loading…
Cancel
Save