Skip to content

Commit

Permalink
changed thread to daemon
Browse files Browse the repository at this point in the history
  • Loading branch information
mjishnu committed Aug 23, 2022
1 parent 8bff97a commit 6439440
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def __init__(self):
self.alive = True
self.dic['paused'] = False

def download(self, url, filepath, num_connections):
def download(self, url, filepath, num_connections=20):
f_path = filepath + '.progress.json'
bcontinue = Path(f_path).exists()
singlethread = False
Expand Down Expand Up @@ -182,6 +182,7 @@ def download(self, url, filepath, num_connections):
for i in range(num_connections):
md = Multidown(self.dic, i)
th = Thread(target=md.worker)
th.daemon = True
threads.append(th)
th.start()
self.workers.append(md)
Expand Down Expand Up @@ -219,9 +220,4 @@ def download(self, url, filepath, num_connections):
print('Download completed!')
Path(f_path).unlink()
else:
print('Download interrupted!')

# if __name__ == "__main__":
# d = Downloader()
# url = "https://gamedownloads.rockstargames.com/public/installer/Rockstar-Games-Launcher.exe"
# d.download(url,"./Downloads/rockstar.exe",4)
print('Download interrupted!')

0 comments on commit 6439440

Please sign in to comment.