aboutsummaryrefslogtreecommitdiff
path: root/update.py
diff options
context:
space:
mode:
authorAlexander Hayden <alexhayden25@gmail.com>2020-01-06 13:15:29 -0500
committerAlexander Hayden <alexhayden25@gmail.com>2020-01-06 13:15:29 -0500
commitb3143d05ded23bc09cf960f73b4f2fa6c390b4a7 (patch)
tree0e60deacf9ae40ff9d69b759e6a0b876b785c0d3 /update.py
parente03629e0449a082390f8a22da0dce00a38c0ebc7 (diff)
downloadmodpackman-b3143d05ded23bc09cf960f73b4f2fa6c390b4a7.tar.gz
modpackman-b3143d05ded23bc09cf960f73b4f2fa6c390b4a7.zip
Add progress indicator
Diffstat (limited to 'update.py')
-rwxr-xr-xupdate.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/update.py b/update.py
index 5cf99f9..a7d3ab2 100755
--- a/update.py
+++ b/update.py
@@ -64,17 +64,20 @@ def install(args):
# whitelist client mods (e.g. optifine)
names += [line[0] for line in read_file(args.whitelist_file)]
+ i = 0
for mod in mods:
mod_path = os.path.join(args.pack_location, mod[0])
+ i += 1
if os.path.exists(mod_path) and os.path.isfile(mod_path) and \
hashlib.sha1(open(mod_path, 'rb').read()).hexdigest() == mod[1]:
print("Skipping {mod[0]}, already up to date".format(mod=mod))
else:
print('Installing {mod[0]} from {mod[2]}...'.format(mod=mod))
+ print(' ({i} of {x})'.format(i=i,x=len(mods)), end='\r')
download_obj = requests.get(mod[2], stream=True)
with open(mod_path, "wb") as write_file:
shutil.copyfileobj(download_obj.raw, write_file)
- print("Done!")
+ print("Done!" + " " * 8)
print()
print("Removing old mods...")