Datasets:
| #!/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)) | |