wynnbuilder-forked-for-changes/py_script/validate.py

22 lines
547 B
Python
Raw Normal View History

2022-06-15 11:55:04 -07:00
"""
Used to validate item file - searches for duplicate items. Does not change the file.
TODO: Eventually integrate this into the process scripts, including ings and recipes
Usage:
python validate.py [input file]
"""
2021-01-29 17:10:29 -06:00
import json
2021-07-05 07:13:04 -07:00
import sys
2021-01-29 17:10:29 -06:00
2021-07-05 07:13:04 -07:00
with open(sys.argv[1]) as infile:
2021-01-29 17:10:29 -06:00
data = json.load(infile)
duplicate_map = dict()
for item in data["items"]:
if item["name"] in duplicate_map:
print("DUPLICATE: " + str(item["id"]) + " <-> " + str(duplicate_map[item["name"]]["id"]))
else:
duplicate_map[item["name"]] = item