46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
#!/usr/bin/env python
|
|
|
|
from pip._vendor import tomli
|
|
import glob
|
|
import os
|
|
|
|
def noop():
|
|
return
|
|
|
|
mods = dict()
|
|
|
|
for mod in glob.glob("pack/mods/*.toml"):
|
|
with open(mod, "r") as f:
|
|
data = tomli.load(f)
|
|
moddata = dict()
|
|
moddata["url"] = ""
|
|
|
|
if "modrinth" in data["update"]:
|
|
moddata["url"] = "https://modrinth.com/mod/" + data["update"]["modrinth"]["mod-id"]
|
|
moddata["site"] = "Modrinth"
|
|
elif "curseforge" in data["update"]:
|
|
moddata["url"] = "https://legacy.curseforge.com/projects/" + str(data["update"]["curseforge"]["project-id"])
|
|
moddata["site"] = "CurseForge"
|
|
|
|
moddata["side"] = data["side"]
|
|
|
|
mods[data["name"]] = moddata
|
|
|
|
|
|
with open("wiki/Modlist.md", "w") as f:
|
|
f.write("<table>")
|
|
f.write("\r\n<tr>")
|
|
f.write("<th>Name</th>")
|
|
f.write("<th>Side</th>")
|
|
f.write("<th>Link</th>")
|
|
f.write("</tr>\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>")
|