-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
33 lines (26 loc) · 725 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python3
# Shoddy run script
import os
import json
import sys
from pprint import pprint
from bytes_encoder import BytesEncoder
import tf2_dem_py.demo_parser
from tf2_dem_py.flags import FLAGS
if __name__ == "__main__":
if len(sys.argv) > 1:
p = sys.argv[1]
else:
p = os.path.join(
os.environ["USERPROFILE"], "Documents", "demos",
"autodemo2019-08-18_14-36-22.dem"
)
dp = tf2_dem_py.demo_parser.DemoParser(
FLAGS.CHAT | FLAGS.GAME_EVENTS
)
print("Demo parser constructed and it didn't segfault!")
res = dp.parse(p)
print("Returned to python")
# pprint(res, sort_dicts=False, compact=True)
with open("lastdemo.json", "w") as h:
json.dump(res, h, indent = "\t", cls = BytesEncoder)