From 7993367970f7ec41a8b8b30684ff4764ef1281f7 Mon Sep 17 00:00:00 2001 From: Valiec Date: Thu, 11 Jul 2019 20:00:00 -0400 Subject: [PATCH] Undid curseforge changes on master (moving them to their own branch). --- delta_gui.py | 10 +--------- delta_install.py | 6 ------ delta_util.py | 46 ---------------------------------------------- 3 files changed, 1 insertion(+), 61 deletions(-) diff --git a/delta_gui.py b/delta_gui.py index 854f0c0..41f80a7 100644 --- a/delta_gui.py +++ b/delta_gui.py @@ -81,10 +81,7 @@ def updateinfo(event): elif len(_mods) == 1: _mod = _mods[0] if event.widget == tkinst.mlist: - if(int(_mod) < len(tkinst.mods)): - name = tkinst.mods[int(_mod)]["Name"] - else: - name = tkinst.mods_curse[int(_mod)-len(tkinst.mods)] + name = tkinst.mods[int(_mod)]["Name"] elif event.widget == tkinst.mlisti: name = tkinst.modsi[int(_mod)]["Name"] iprint(get_info_console(name, output=False)) @@ -159,15 +156,10 @@ def __init__(self, master = None): self.pack(expand=True, fill=tk.BOTH) def update_modlist(self): self.mods = listmods_all(False) - self.mods_curse = json.loads(requests.get("http://kpabr.com/curse/mods").text) self.mlist.delete(0, tk.END) for mod in self.mods: - #print(mod) if mod != None: self.mlist.insert(tk.END, mod["Name"]) - for mod in self.mods_curse: - #print(mod) - self.mlist.insert(tk.END, mod) def initialise_window(self): self.master.title("DeltaMC v2.1.0") #self.master.geometry("800x400") diff --git a/delta_install.py b/delta_install.py index d42b033..36821d6 100644 --- a/delta_install.py +++ b/delta_install.py @@ -28,7 +28,6 @@ def recieve_tkinst_install(data): def install_mod(modname, version = None): - mods_curse = json.loads(requests.get("http://kpabr.com/curse/mods").text) os.chdir(execdir + "/Data/DeltaMC-Archive") if(modname == None): modname = cinput("Enter mod name: ") @@ -36,9 +35,6 @@ def install_mod(modname, version = None): for file in glob.glob(modname + ".json"): cprint(file + " found.") mod_data = get_mod_from_name(modname) - elif modname in mods_curse: - cprint(modname + " found on CurseForge.") - mod_data = get_mod_from_json(get_mod_from_curse(modname)) else: cprint("Mod "+modname+" not found.") return -1 @@ -82,8 +78,6 @@ def install_mod(modname, version = None): newfilename = modname + ".installed" with open(newfilename, 'w+') as newfile: installedjson = get_json(modname) - if installedjson == None: - installedjson = get_mod_from_curse(modname) installedjson["Versions"] = [mod_data.versions[version_number]] newfile.write(json.dumps(installedjson)) diff --git a/delta_util.py b/delta_util.py index 8c2f14b..7042ed8 100644 --- a/delta_util.py +++ b/delta_util.py @@ -366,9 +366,7 @@ def update_archive(start=False): shutil.rmtree("DeltaMC-Archive") # Archive Download url = "https://github.com/deltamc-project/deltamc-archive/tarball/master" - #curse_url = "https://addons-ecs.forgesvc.net/api/v2/addon/search?&gameId=432" #this is from the Twitch/Curse API, it gets all mods on CurseForge at once file_name = "DeltaMC.tar.gz" - #curse_file_name = "cursemods.json" cprint("Downloading Archive...") # Download it. try: @@ -492,51 +490,7 @@ def get_mod_from_json(json_data): json_data["Unstable"], json_data["Versions"]) return mod -def get_mod_from_json_curse(entry): - authors = [] - for author in entry["authors"]: - authors.append(author["name"]) - versions = [] - for version in entry["gameVersionLatestFiles"]: - versiondict = {} - versiondict["Version"] = version["projectFileId"] - versiondict["MCVersion"] = [version["gameVersion"]] - versiondict["Link"] = "https://www.curseforge.com/minecraft/mc-mods/"+entry["slug"]+"/download/"+str(version["projectFileId"]) - versions.append(versiondict) - mod = Mod(entry["slug"], ", ".join(authors), entry["summary"], "N/A", "N/A", "Forge", "N/A", versions) - return mod - -def get_json_from_curse(entry): - authors = [] - for author in entry["authors"]: - authors.append(author["name"]) - versions = [] - for version in entry["gameVersionLatestFiles"]: - versiondict = {} - versiondict["Version"] = str(version["projectFileId"]) - versiondict["MCVersion"] = [version["gameVersion"]] - versiondict["Link"] = "https://www.curseforge.com/minecraft/mc-mods/"+entry["slug"]+"/download/"+str(version["projectFileId"]) - versions.append(versiondict) - mod = {"Name": entry["slug"], "Author": ", ".join(authors), "Desc": entry["summary"], "License": "N/A", "Requirements": [], "Incompatibilities": [], "Recommended": [], "Type": "Forge", "Unstable": "N/A", "Versions": versions} - return mod - -def get_mod_from_curse(modname): - entry = json.loads(requests.get("https://ddph1n5l22.execute-api.eu-central-1.amazonaws.com/dev/mod/"+modname).text)["result"] - versions_data = json.loads(requests.get("https://ddph1n5l22.execute-api.eu-central-1.amazonaws.com/dev/mod/"+modname+"/files").text)["result"] - versions = [] - for version in versions_data: - versiondict = {} - versiondict["Version"] = str(version["id"]) - versiondict["MCVersion"] = version["minecraft_version"][0] - versiondict["Link"] = version["download_url"] - versions.append(versiondict) - mod = {"Name": entry["name"], "Author": entry["owner"], "Desc": entry["description"], "License": "N/A", "Requirements": [], "Incompatibilities": [], "Recommended": [], "Type": "Forge", "Unstable": "N/A", "Versions": versions} - return mod - - def get_mod_from_name(modname): - if get_json(modname) == None: - return get_mod_from_json(get_mod_from_curse(modname)) return get_mod_from_json(get_json(modname)) def get_url(mod, version):