Skip to content

Commit 0f4627f

Browse files
committed
add ctftime_export.py
1 parent e0ecfb0 commit 0f4627f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

ctftime_export.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import json
2+
import sys
3+
4+
if len(sys.argv) != 2:
5+
print(f"Usage: {sys.argv[0]} path/to/scoreboard.json")
6+
sys.exit(1)
7+
8+
9+
TEAM_BLACKLIST = [1]
10+
out = {"standings": []}
11+
12+
sb = json.load(open(sys.argv[1], "r"))
13+
for (pos, team) in enumerate(sb["teams"]):
14+
if team["teamId"] in TEAM_BLACKLIST:
15+
continue
16+
17+
out["standings"].append({
18+
"pos": pos + 1,
19+
"team": team["teamName"],
20+
"score": team["totalScore"],
21+
})
22+
23+
print(json.dumps(out))

0 commit comments

Comments
 (0)