2024-05-13 20:50:01 +00:00
|
|
|
from ItemRelate import main as relate
|
|
|
|
import json
|
2024-05-14 04:08:37 +00:00
|
|
|
import os
|
2024-05-13 20:50:01 +00:00
|
|
|
|
2024-05-14 05:04:54 +00:00
|
|
|
def batch():
|
|
|
|
scales = os.listdir("Scales")
|
|
|
|
items={}
|
|
|
|
for i in scales:
|
|
|
|
with open("Scales/"+i,"r") as scale:
|
|
|
|
tmp = json.load(scale)
|
|
|
|
for i in tmp["item"]:
|
|
|
|
items[i]=tmp["item"][i]
|
|
|
|
# print(items)
|
|
|
|
return items
|
|
|
|
|
|
|
|
def old_type(str):
|
|
|
|
with open(str,"r") as file:
|
|
|
|
scale=json.load(file)
|
|
|
|
new={"item":{}}
|
|
|
|
for i in scale:
|
|
|
|
new["item"][i["name"]]=i["label"]
|
|
|
|
# print(i["name"],i["label"])
|
|
|
|
with open(str,"w") as file:
|
|
|
|
file.write(json.dumps(new))
|
|
|
|
|
|
|
|
# old_type("Scales/ceE.json")
|
|
|
|
|
|
|
|
if os.path.getsize("Temp/items.json") == 0:
|
|
|
|
que=relate(batch())
|
|
|
|
with open("Temp/items.json","w") as items:
|
2024-05-14 04:08:37 +00:00
|
|
|
items.write(json.dumps(que))
|
|
|
|
else:
|
2024-05-14 05:04:54 +00:00
|
|
|
with open("Temp/items.json","r") as items:
|
2024-05-14 04:08:37 +00:00
|
|
|
que = json.load(items)
|
2024-05-13 20:50:01 +00:00
|
|
|
|
2024-05-14 05:04:54 +00:00
|
|
|
for i in que:
|
|
|
|
print(i)
|