posspack/.forgejo/scripts/update-wiki.py
Ashley Graves 2fe17450b0
All checks were successful
Update wiki / test (push) Successful in 13s
test
2024-07-27 14:55:49 +02:00

31 lines
743 B
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)
url = ""
# there has to be a better way to do this
if "modrinth" in data["update"]:
url = "https://modrinth.com/mod/" + data["update"]["modrinth"]["mod-id"]
elif "curseforge" in data["update"]:
url = "http://dev.bukkit.org/bukkit-plugins/" + str(data["update"]["curseforge"]["project-id"])
mods[data["name"]] = url
with open("wiki/Modlist.md", "w") as f:
for mod in mods:
if mods[mod] != "":
f.write("- [" + mod + "](" + mods[mod] + ")\r\n")
else:
f.write("- " + mod + "\r\n")