fix Last-Modified mtime overwriting post processor mtime (#7529)
https://github.com/mikf/gallery-dl/issues/7529#issuecomment-2989955455 - split '_mtime' into '_mtime_http' and '_mtime_meta' - add PathFormat.set_mtime() method
This commit is contained in:
@@ -348,6 +348,11 @@ class PathFormat():
|
||||
pass
|
||||
return 0
|
||||
|
||||
def set_mtime(self, path=None):
|
||||
if (mtime := (self.kwdict.get("_mtime_meta") or
|
||||
self.kwdict.get("_mtime_http"))):
|
||||
util.set_mtime(self.realpath if path is None else path, mtime)
|
||||
|
||||
def finalize(self):
|
||||
"""Move tempfile to its target location"""
|
||||
if self.delete:
|
||||
@@ -381,6 +386,4 @@ class PathFormat():
|
||||
os.unlink(self.temppath)
|
||||
break
|
||||
|
||||
mtime = self.kwdict.get("_mtime")
|
||||
if mtime:
|
||||
util.set_mtime(self.realpath, mtime)
|
||||
self.set_mtime()
|
||||
|
||||
Reference in New Issue
Block a user