Use file mtime in local crawler

This commit is contained in:
Joscha 2021-05-13 19:42:40 +02:00
parent 38bb66a776
commit 94d6a01cca

View File

@ -1,4 +1,5 @@
import asyncio
import datetime
from pathlib import Path, PurePath
from ..conductor import TerminalConductor
@ -48,12 +49,14 @@ class LocalCrawler(Crawler):
async def _crawl_file(self, path: Path, pure: PurePath) -> None:
async with self.download_bar(path) as bar:
bar.set_total(path.stat().st_size)
dl = await self.download(pure)
stat = path.stat()
mtime = datetime.datetime.fromtimestamp(stat.st_mtime)
dl = await self.download(pure, mtime=mtime)
if not dl:
return
bar.set_total(stat.st_size)
async with dl as sink:
with open(path, "rb") as f:
while True: