19 lines
495 B
Python
19 lines
495 B
Python
import subprocess
|
|
import json
|
|
|
|
with open("./events.json", "r") as f:
|
|
sports = json.load(f)
|
|
|
|
ret = {}
|
|
for sport in sports:
|
|
ret[sport] = {}
|
|
for event in sports[sport]:
|
|
stdout = subprocess.check_output(f'./get-results.sh {sport} {event}', shell=True)
|
|
result = json.loads(stdout)
|
|
ret[sport][event] = result
|
|
print(f"Done with {sport} >> {event}")
|
|
|
|
with open("./results.json", "w") as f:
|
|
json.dump(ret, f, indent=4, ensure_ascii=False, sort_keys=True)
|
|
|