2022-06-15 18:55:04 +00: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 23:10:29 +00:00
|
|
|
import json
|
2021-07-05 14:13:04 +00:00
|
|
|
import sys
|
2021-01-29 23:10:29 +00:00
|
|
|
|
2021-07-05 14:13:04 +00:00
|
|
|
with open(sys.argv[1]) as infile:
|
2021-01-29 23:10:29 +00: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
|