File size: 584 Bytes
12b5ac7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env python3
"""Regenerate ../characters.json from manifests/character_manifest.jsonl."""
import json, os
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(HERE)
mf  = os.path.join(HERE, "manifests", "character_manifest.jsonl")
out = os.path.join(ROOT, "characters.json")
d = {}
for line in open(mf):
    line = line.strip()
    if not line: continue
    e = json.loads(line)
    d[e["file"]] = {"name": e.get("name"), "uuid": e.get("uuid")}
json.dump(d, open(out, "w"), indent=1, ensure_ascii=False, sort_keys=True)
print("wrote", out, "->", len(d))