Skip to content

Commit

Permalink
Undid curseforge changes on master (moving them to their own branch).
Browse files Browse the repository at this point in the history
  • Loading branch information
Valiec committed Jul 12, 2019
1 parent 84f90ef commit 7993367
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 61 deletions.
10 changes: 1 addition & 9 deletions delta_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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")
Expand Down
6 changes: 0 additions & 6 deletions delta_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,13 @@ 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: ")
if(os.path.exists(modname + ".json")): # Telling user that file exists
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
Expand Down Expand Up @@ -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))

Expand Down
46 changes: 0 additions & 46 deletions delta_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 7993367

Please sign in to comment.