#!/usr/bin/env python
from pip._vendor import tomli
import glob
import os
def noop():
return
mods = dict()
count = dict()
count["server"] = 0
count["client"] = 0
count["both"] = 0
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"
count[data["side"]] += 1
moddata["side"] = data["side"]
mods[data["name"]] = moddata
with open("wiki/Modlist.md", "w") as f:
f.write("## Total Count\r\n")
f.write("
")
f.write("\r\n")
f.write("Side | ")
f.write("Count | ")
f.write("
\r\n")
f.write("")
f.write("Shared | ")
f.write("" + str(count["both"]) + " | ")
f.write("
\r\n")
f.write("")
f.write("Client | ")
f.write("" + str(count["client"]) + " | ")
f.write("
\r\n")
f.write("")
f.write("Server | ")
f.write("" + str(count["server"]) + " | ")
f.write("
\r\n")
f.write("
\r\n\r\n")
f.write("## Individual Mods\r\n")
f.write("")
f.write("\r\n")
f.write("Name | ")
f.write("Side | ")
f.write("Link | ")
f.write("
\r\n")
for mod in mods:
f.write("\r\n")
f.write("" + mod + " | ")
f.write("" + mods[mod]["side"] + " | ")
if mods[mod]["url"] != "":
f.write("" + mods[mod]["site"] + " | ")
else:
f.write("N/A | ")
f.write("\r\n
")
f.write("\r\n
")