diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2019-05-16 16:52:32 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2019-05-16 16:52:32 -0300 |
commit | a7ce9e79bbc81b5abfde4b8e99e95d039a092baa (patch) | |
tree | 430d4b7f3b2bccc8032f82ef3a11a434ad5e11b0 | |
parent | 47b7b92fe7aa4509436b3dc8be50eb20cf3a3923 (diff) | |
download | ckandumper-a7ce9e79bbc81b5abfde4b8e99e95d039a092baa.tar.gz ckandumper-a7ce9e79bbc81b5abfde4b8e99e95d039a092baa.tar.bz2 |
Cleanup
-rwxr-xr-x | ckandumper | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -119,13 +119,14 @@ class DownloadMultiple: return proc.returncode - async def gather(self, filepairs, progress_bar): + async def gather(self, filepairs): """Gather all files to be downloaded See https://stackoverflow.com/questions/50308812/is-it-possible-to-limit-the-number-of-coroutines-running-corcurrently-in-asyncio#50328882 """ - jobs = [] + jobs = [] + progress_bar = tqdm(total=len(filepairs)) if self.progress and len(filepairs) > 1 else False for url, filename in filepairs: jobs.append(asyncio.ensure_future(self.download_file(url, filename, self.limit_concurrent, progress_bar))) @@ -133,12 +134,11 @@ class DownloadMultiple: await asyncio.gather(*jobs) def get(self, filepairs): - self.stats = { 'exitstatus': {} } - progress_bar = tqdm(total=len(filepairs)) if self.progress and len(filepairs) > 1 else False - loop = asyncio.get_event_loop() + self.stats = { 'exitstatus': {} } + loop = asyncio.get_event_loop() loop.set_debug(self.debug) - loop.run_until_complete(self.gather(filepairs, progress_bar)) + loop.run_until_complete(self.gather(filepairs)) if self.debug: print(self.stats) |