mirror of
https://github.com/Garmelon/PFERD.git
synced 2026-04-12 07:25:04 +02:00
Print mtime before updating file metadata
This commit is contained in:
parent
533bc27439
commit
03efa17cf1
2 changed files with 4 additions and 0 deletions
|
|
@ -514,8 +514,11 @@ class IliasPage:
|
||||||
f"td.std:nth-child({index})"
|
f"td.std:nth-child({index})"
|
||||||
).getText().strip()
|
).getText().strip()
|
||||||
if re.search(r"\d+\.\d+.\d+ - \d+:\d+", modification_string):
|
if re.search(r"\d+\.\d+.\d+ - \d+:\d+", modification_string):
|
||||||
|
log.explain(f"Converting {modification_string!r}")
|
||||||
modification_time = datetime.strptime(modification_string, "%d.%m.%Y - %H:%M")
|
modification_time = datetime.strptime(modification_string, "%d.%m.%Y - %H:%M")
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
log.explain(f"Date has wrong format: {modification_string!r}")
|
||||||
|
|
||||||
if modification_time is None:
|
if modification_time is None:
|
||||||
log.warn(f"Could not determine upload time for {link}")
|
log.warn(f"Could not determine upload time for {link}")
|
||||||
|
|
|
||||||
|
|
@ -415,6 +415,7 @@ class OutputDirectory:
|
||||||
|
|
||||||
def _update_metadata(self, info: DownloadInfo) -> None:
|
def _update_metadata(self, info: DownloadInfo) -> None:
|
||||||
if mtime := info.heuristics.mtime:
|
if mtime := info.heuristics.mtime:
|
||||||
|
log.explain(f"Setting mtime to {mtime}")
|
||||||
mtimestamp = mtime.timestamp()
|
mtimestamp = mtime.timestamp()
|
||||||
os.utime(info.local_path, times=(mtimestamp, mtimestamp))
|
os.utime(info.local_path, times=(mtimestamp, mtimestamp))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue