1
0
mirror of https://github.com/one-among-us/data.git synced 2024-11-14 23:34:51 +08:00
one-among-us-data/generator.py

17 lines
624 B
Python
Raw Normal View History

2021-11-13 02:49:44 +08:00
import io
import os, json5
from pathlib import Path
2021-11-13 02:49:44 +08:00
if __name__ == '__main__':
output = []
for p in os.listdir("people/"):
info_path = f'people/{p}/info.json5'
if os.path.isfile(info_path):
with io.open(info_path, 'r', encoding='utf-8') as f:
o = json5.load(f)
2021-12-30 01:03:00 +08:00
output.append({'path': p, 'id': o['id'], 'name': o['name'], 'profileUrl': o['profileUrl']})
2021-11-13 02:49:44 +08:00
Path("generated").mkdir(parents=True, exist_ok=True)
2021-11-13 02:49:44 +08:00
with io.open('generated/people-list.json5', 'w', encoding='utf-8') as f:
f.write(json5.dumps(output, indent=2, ensure_ascii=False))