test
Some checks failed
Update wiki / test (push) Failing after 12s

This commit is contained in:
Ashley Graves 2024-07-27 15:43:27 +02:00
parent 2ce9e5c31a
commit 0a1a63c231

View file

@ -12,27 +12,35 @@ mods = dict()
for mod in glob.glob("pack/mods/*.toml"): for mod in glob.glob("pack/mods/*.toml"):
with open(mod, "r") as f: with open(mod, "r") as f:
data = tomli.load(f) data = tomli.load(f)
url = "" moddata = dict()
moddata["url"] = ""
# there has to be a better way to do this
if "modrinth" in data["update"]: if "modrinth" in data["update"]:
url = "https://modrinth.com/mod/" + data["update"]["modrinth"]["mod-id"] moddata["url"] = "https://modrinth.com/mod/" + data["update"]["modrinth"]["mod-id"]
moddata["site"] = "Modrinth"
elif "curseforge" in data["update"]: elif "curseforge" in data["update"]:
url = "https://legacy.curseforge.com/projects/" + str(data["update"]["curseforge"]["project-id"]) moddata["url"] = "https://legacy.curseforge.com/projects/" + str(data["update"]["curseforge"]["project-id"])
moddata["site"] = "CurseForge"
moddata = dict()
moddata["side"] = data["side"] moddata["side"] = data["side"]
moddata["url"] = url
mods[data["name"]] = moddata mods[data["name"]] = moddata
with open("wiki/Modlist.md", "w") as f: with open("wiki/Modlist.md", "w") as f:
for mod in mods: f.write("<table>")
if mods[mod]["url"] != "": f.write("\r\n<tr>")
f.write("- [" + mod + "](" + mods[mod]["url"] + ")") f.write("<th>Name</th>")
else: f.write("<th>Side</th>")
f.write("- " + mod) f.write("<th>Link</th>")
f.write("</tr>\r\n")
f.write(" (" + mods[mod]["side"] + ")\r\n") for mod in mods:
f.write("\r\n<tr>")
f.write("<td>" + mod + "</td>")
f.write("<td>" + mods[mod]["side"] + "</td>")
if mods[mod]["url"] != "":
f.write("<td><a href=\"" + mods[mod]["url"] + "\">" + moddata[mod]["host"] + "</a></td>")
else:
f.write("<td>N/A</td>")
f.write("\r\n<tr>")