aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2019-05-16 16:52:32 -0300
committerSilvio Rhatto <rhatto@riseup.net>2019-05-16 16:52:32 -0300
commita7ce9e79bbc81b5abfde4b8e99e95d039a092baa (patch)
tree430d4b7f3b2bccc8032f82ef3a11a434ad5e11b0
parent47b7b92fe7aa4509436b3dc8be50eb20cf3a3923 (diff)
downloadckandumper-a7ce9e79bbc81b5abfde4b8e99e95d039a092baa.tar.gz
ckandumper-a7ce9e79bbc81b5abfde4b8e99e95d039a092baa.tar.bz2
Cleanup
-rwxr-xr-xckandumper12
1 files changed, 6 insertions, 6 deletions
diff --git a/ckandumper b/ckandumper
index 121f33b..a7464d8 100755
--- a/ckandumper
+++ b/ckandumper
@@ -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)