Skip to content

Commit

Permalink
feat: image: set mtime for downloaded file
Browse files Browse the repository at this point in the history
  • Loading branch information
yzqzss committed Sep 12, 2023
1 parent 0039463 commit fa4aa24
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions wikiteam3/dumpgenerator/dump/image/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@ def get_ia_wbm_response() -> Optional[requests.Response]:
config=config, to_stdout=True,
text=f"File '{e.file}' size is not match '{e.size}', skipping",
)
if timestamp != NULL:
# try to set file timestamp (mtime)
try:
mtime = datetime.datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%SZ").timestamp()
atime = os.stat(filepath_underscore).st_atime
# atime is not modified
os.utime(filepath_underscore, times=(atime, mtime))
# print(atime, mtime)
except Exception as e:
print("WARNING: ", e)
else:
log_error(
config=config, to_stdout=True,
Expand Down

0 comments on commit fa4aa24

Please sign in to comment.