From 1e6f11eaf36acc0f2dfc2a6d6cdf2b6b413ca6d2 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Thu, 1 Aug 2024 01:27:21 +0200 Subject: [PATCH] test --- .forgejo/scripts/update-wiki.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.forgejo/scripts/update-wiki.py b/.forgejo/scripts/update-wiki.py index 7d719de..ab8343c 100644 --- a/.forgejo/scripts/update-wiki.py +++ b/.forgejo/scripts/update-wiki.py @@ -13,8 +13,9 @@ count["client"] = 0 count["both"] = 0 cache = dict() -with open("licenses.json") as f: - cache = json.load(f) + + with open("licenses.json") as f: + cache = json.load(f) for mod in glob.glob("pack/mods/*.toml"): with open(mod, "r") as f: @@ -31,18 +32,16 @@ for mod in glob.glob("pack/mods/*.toml"): moddata["site"] = "Modrinth" if moddata["name"] in cache: - data = cache[moddata["name"]] + data = cache[id] else: data = requests.get("https://api.modrinth.com/v2/project/" + id).json()["license"] - with open("licenses.json") as f: - f.write(json.dumps(data)) + cache[id] = data elif "curseforge" in data["update"]: moddata["url"] = "https://legacy.curseforge.com/projects/" + str(data["update"]["curseforge"]["project-id"]) moddata["site"] = "CurseForge" count[moddata["side"]] += 1 mods[moddata["name"]] = moddata - with open("wiki/Modlist.md", "w") as f: f.write("## Total Count\r\n") @@ -107,3 +106,6 @@ with open("wiki/Licenses.md", "w") as f: else: f.write("Unknown") f.write("\r\n") + +with open("licenses.json") as f: + json.dump(cache, f)