aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/postprocessor/mtime.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2022-04-09 00:15:29 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2022-04-09 00:15:29 -0400
commit3b47fa099cb0a81abf1ffe78d23c0ac0298bbe76 (patch)
tree30a6fc06d988c0b9afaf0fbc8106cdfe348724fd /gallery_dl/postprocessor/mtime.py
parent789065f88da4a4c76add665ad86ea58a41ef372c (diff)
parent2fe1dfed848fc26b7419e3bfe91a62e686960429 (diff)
Update upstream source from tag 'upstream/1.21.1'
Update to upstream version '1.21.1' with Debian dir 2dd1f53e28243e27b11cf3ef5404ef595729b6a7
Diffstat (limited to 'gallery_dl/postprocessor/mtime.py')
-rw-r--r--gallery_dl/postprocessor/mtime.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/gallery_dl/postprocessor/mtime.py b/gallery_dl/postprocessor/mtime.py
index 098984a..3f8d90a 100644
--- a/gallery_dl/postprocessor/mtime.py
+++ b/gallery_dl/postprocessor/mtime.py
@@ -9,7 +9,8 @@
"""Use metadata as file modification time"""
from .common import PostProcessor
-from ..text import parse_int
+from .. import text, util
+from datetime import datetime
class MtimePP(PostProcessor):
@@ -27,8 +28,11 @@ class MtimePP(PostProcessor):
def run(self, pathfmt):
mtime = pathfmt.kwdict.get(self.key)
- ts = getattr(mtime, "timestamp", None)
- pathfmt.kwdict["_mtime"] = ts() if ts else parse_int(mtime)
+ pathfmt.kwdict["_mtime"] = (
+ util.datetime_to_timestamp(mtime)
+ if isinstance(mtime, datetime) else
+ text.parse_int(mtime)
+ )
__postprocessor__ = MtimePP