Skip to content

Commit

Permalink
added some spaghetti code, oh and a progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Faraphel committed May 22, 2021
1 parent 347661f commit 6346583
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion Updater/Updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,18 @@
URL = gitversion["download_bin"]

dl = requests.get(URL, allow_redirects=True, stream=True)
dl_size = int(dl.headers["Content-Length"])

with open("./download.zip", "wb") as file:
print(f"Téléchargement de la version {gitversion['version']}.{gitversion['subversion']} en cours...")
for chunk in dl.iter_content(chunk_size=1024): file.write(chunk)
chunk_size = 1024
for i, chunk in enumerate(dl.iter_content(chunk_size=chunk_size)):
progress = int((i * chunk_size * 100) / dl_size)
print("("+str(progress)+"%) | " + "#" * (progress//5) + "_"* (20 - (progress//5)) + " | " +
str(round(i*chunk_size/1000000,1)) + "Mo/" + str(round(dl_size/1000000,1)) + "Mo", end="\r")
file.write(chunk)
file.flush()

print("fin du téléchargement, début de l'extraction...")

with zipfile.ZipFile("./download.zip") as file:
Expand Down
Binary file modified Updater/Updater.zip
Binary file not shown.
3 changes: 2 additions & 1 deletion Updater/build.bat
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
"../venv/Scripts/python.exe" "./setup.py" build
"../venv/Scripts/python.exe" "./setup.py" build
pause

0 comments on commit 6346583

Please sign in to comment.