Divide download module

This commit is contained in:
taizan-hokuto
2020-02-02 00:38:22 +09:00
parent 04aedc82e8
commit f1d8393971
4 changed files with 122 additions and 105 deletions

View File

@@ -1,11 +1,10 @@
from . import parser
class DownloadWorker:
def __init__(self, dl, block, blocklist):
self.block = block
self.blocklist = blocklist
self.dl = dl
def __init__(self, fetch, block):
self.block = block
self.fetch = fetch
async def run(self,session):
temp_last = self.block.temp_last
self.block.chat_data, continuation = self.cut(
@@ -14,7 +13,7 @@ class DownloadWorker:
self.block.last,
temp_last )
while continuation:
data, cont, fetched_last = await self.dl(continuation, session)
data, cont, fetched_last = await self.fetch(continuation, session)
data, continuation = self.cut(data, cont, fetched_last, temp_last)
self.block.chat_data.extend(data)