summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-08-05 01:50:01 -0300
committerJesusaves <cpntb1@ymail.com>2021-08-05 01:51:46 -0300
commit75ad2c2486cc7ad81fc5b7b59a7bd0b6dd0f2452 (patch)
tree7b8d8b14c004471fa5b5a917116f39252a319d15
parent1fb1634ef64470651ae9125526162162549c38a7 (diff)
downloadrenpy-75ad2c2486cc7ad81fc5b7b59a7bd0b6dd0f2452.tar.gz
renpy-75ad2c2486cc7ad81fc5b7b59a7bd0b6dd0f2452.tar.bz2
renpy-75ad2c2486cc7ad81fc5b7b59a7bd0b6dd0f2452.tar.xz
renpy-75ad2c2486cc7ad81fc5b7b59a7bd0b6dd0f2452.zip
Report how M+ download is progressing, and hopefully, finish it faster.
Code "borrowed" from Mana Spheres (and borrowed from Stack Overflow in turn)
-rw-r--r--game/3rdparty.rpy16
1 files changed, 11 insertions, 5 deletions
diff --git a/game/3rdparty.rpy b/game/3rdparty.rpy
index 49759fc..163915d 100644
--- a/game/3rdparty.rpy
+++ b/game/3rdparty.rpy
@@ -17,15 +17,21 @@ init 1 python:
return False
status_update("Saving %s..." %fname, 64)
+ msize = int(r.headers.get('content-length', 0))
+ bsize = 4096
+ csize = msize / 7
+ cstep = 0
with open(installdir+"/%s" % fname, 'wb') as fd:
- for chunk in r.iter_content(chunk_size=128):
+ for chunk in r.iter_content(bsize):
fd.write(chunk)
+ cstep += bsize
+ status_update(pc=64+(cstep / csize))
- status_update("Verifying MD5 hash...", 67)
+ status_update("Verifying MD5 hash...", 70)
r=requests.get(persistent.host+"/%s.md5" % fname, timeout=10.0)
md5up=r.text.replace("\n", "")
- status_update("Verifying MD5 hash...", 69)
+ status_update("Verifying MD5 hash...", 71)
md5us=md5sum(installdir+"/%s" % fname)
if md5up != md5us:
status_update("MD5 Hash Error")
@@ -46,7 +52,7 @@ init 1 python:
if not download_manaplus("ManaPlus.AppImage"):
return False
- status_update("Marking as executable...", 70)
+ status_update("Marking as executable...", 72)
execute("chmod +x \"%s\"" % installdir+"/ManaPlus.AppImage", shell=True)
status_update("Installation successful!", 75)
#########################################################
@@ -54,7 +60,7 @@ init 1 python:
if not download_manaplus("ManaPlus.zip"):
return False
- status_update("Unzipping file...", 70)
+ status_update("Unzipping file...", 72)
with zipfile.ZipFile(installdir+"/ManaPlus.zip", 'r') as zip_ref:
zip_ref.extractall(installdir)
status_update("Installation successful!", 75)