planet-wars/frontend/parse.py
2019-09-24 15:31:21 +02:00

17 lines
451 B
Python
Executable file

#!/usr/bin/python3
import sys
import json
for arg in sys.argv[1:]:
with open(arg, "r") as f:
with open("out/"+arg, "w+") as w:
print(arg)
for line in f.readlines():
obj = json.loads(line)
if "info" in obj:
w.write(json.dumps(obj["info"])+"\n")
if "state" in obj:
w.write(json.dumps(obj["state"])+"\n")
w.flush()