mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Use file mtime in local crawler
This commit is contained in:
parent
38bb66a776
commit
94d6a01cca
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user