-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCS2RTVtoGGMC.py
More file actions
35 lines (24 loc) · 862 Bytes
/
CS2RTVtoGGMC.py
File metadata and controls
35 lines (24 loc) · 862 Bytes
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
34
35
import json
import sys
def convert_maps(input, output):
result = {}
with open(input, "r") as f:
for line in f:
line = line.strip()
if not line:
continue
parts = line.split(":", 1)
name = parts[0].strip()
id = parts[1].strip() if len(parts) > 1 else None
entry = {"ws": bool(id), "minplayers": 0, "maxplayers": 64, "weight": 1}
if id:
entry["mapid"] = id
result[name] = entry
with open(output, "w") as f:
json.dump(result, f, indent=2)
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: python3 CS2RTVtoGGMC.py <input.txt> <output.json>")
sys.exit(1)
convert_maps(sys.argv[1], sys.argv[2])
print(f"Converted {sys.argv[1]} to {sys.argv[2]} successfully!")