diff options
author | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-11-18 23:08:23 +1100 |
---|---|---|
committer | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-11-18 23:08:23 +1100 |
commit | 83f603644e95884bd3b1f764192c4545fe45ee44 (patch) | |
tree | 572d1453c016c0dd208ecc919ad0ab572f7d2aa1 /script.py | |
parent | 22f8c106e17b197045aa16e6d492d0d047c0baa7 (diff) | |
download | NotEnoughUpdates-REPO-83f603644e95884bd3b1f764192c4545fe45ee44.tar.gz NotEnoughUpdates-REPO-83f603644e95884bd3b1f764192c4545fe45ee44.tar.bz2 NotEnoughUpdates-REPO-83f603644e95884bd3b1f764192c4545fe45ee44.zip |
update parents
Diffstat (limited to 'script.py')
-rw-r--r-- | script.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/script.py b/script.py new file mode 100644 index 00000000..8a7c6fa4 --- /dev/null +++ b/script.py @@ -0,0 +1,19 @@ +import json, os + +parents = {} +for itemJsonFileName in os.listdir("./items"): + with open("./items/"+itemJsonFileName, "rb") as f: + try: + itemJson = json.load(f); + except: + print("BROKEN JSON:"+itemJsonFileName) + if "parent" in itemJson: + parent = itemJson["parent"] + if not parent in parents: + parents[parent] = [] + parents[parent].append(itemJson["internalname"]) + +print(parents) + +with open("./parents.json", "w") as f: + json.dump(parents, f, indent=4, sort_keys=True) |