diff options
-rwxr-xr-x | update.py | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -21,17 +21,17 @@ def apply_updates(): with open("downloads.txt", "r") as f: for line in f: dl = line.strip().split(" ") - if len(line) > 3 and len(dl) == 2 and line[0] != '#': - dl[0] = dl[0].strip() - dl[1] = dl[1].strip() + if len(line) >= 1 and line[0] != '#': + # run strip on each element + mod = tuple(map(lambda x: x.strip(), mod)) mods.append(dl) names.add(dl[0]) for mod in mods: - if mod[0] in os.listdir(INSTALL_DIR): + if mod[0] in os.listdir(INSTALL_DIR) and hashlib.sha1(open(os.path.join(INSTALL_DIR, mod[0]), 'rb').read()).hexdigest() == mod[1]: print("Skipping " + mod[0] + ", already up to date") else: print("Installing " + mod[0] + " from " + mod[1] + "...") - download_obj = requests.get(mod[1], stream=True) + download_obj = requests.get(mod[2], stream=True) with open(os.path.join(INSTALL_DIR, mod[0]), "wb") as write_file: shutil.copyfileobj(download_obj.raw, write_file) print("Done!") @@ -50,7 +50,7 @@ def find_updates(): with open('updates.txt') as f: for line in f: mod = line.strip().split() - if len(line) > 3 and len(mod) == 2 and line[0] != '#': + if len(line) >= 1 and line[0] != '#': # run strip on each element mod = tuple(map(lambda x: x.strip(), mod)) mods.add(mod) |