ann-kunshujo / src /mapping.py
Satoru
feat: initial commit
cab1b96
raw
history blame
No virus
569 Bytes
import json
with open('mappings.json') as f:
df = json.load(f)
conf = {}
with open("/Users/nakamura/git/kunshujo/kunshujo/static/data/index.json") as f:
items = json.load(f)
for item in items:
conf[item["objectID"]] = item
for index in df:
item = df[index]
id = item["nconst"]
if id not in conf:
continue
c = conf[id]
item["url"] = c["thumbnail"]
item["name"] = c["label"]
with open('../models/mappings.json', mode='wt', encoding='utf-8') as file:
json.dump(df, file, ensure_ascii=False, indent=2)