diff options
-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) |