-
Notifications
You must be signed in to change notification settings - Fork 0
/
dump.py
42 lines (34 loc) · 1.06 KB
/
dump.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
34
35
36
37
38
39
40
41
42
import os
import sys
import json
from pprint import pprint
if len(sys.argv) != 15:
sys.exit(f"Incorrect argument count, got {len(sys.argv)}, need 15")
data = {
"name": sys.argv[1],
"version": sys.argv[2],
"maintainer": sys.argv[3],
"date_release": sys.argv[4],
"changelog": "$LS" + sys.argv[5].replace(", ", "$LE$LS"),
"status": sys.argv[6],
"support": sys.argv[7],
"rdp": sys.argv[8],
"notes": sys.argv[9] if sys.argv[9] != "none" else None,
"banner": sys.argv[10],
"downloads":
{
"editions":
{
"vanilla": sys.argv[11] if sys.argv[11] != "none" else None,
"gapps": sys.argv[12]
}
}
}
json_data = json.dumps(data, indent=4)
confirm = input(json_data + f"\nDump as roms/{sys.argv[13]}/{sys.argv[14]}.json, OK? y/n\n -> ")
if confirm in ("y", ""):
with open(f"roms/{sys.argv[13]}/{sys.argv[14]}.json", "w+") as json_file:
json_file.write(json_data)
sys.exit(f"Data dumped to roms/{sys.argv[13]} as {sys.argv[14]}.json")
else:
sys.exit(f"Got {confirm}, exit")