File size: 1,087 Bytes
17dcef2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
## Important: run this script from the parent directory
## (the root directory in this repository)
#
# python3 list_scripts/1.py

# The Raw data is very large, so let's make JSON files for all relevant sets
# Note: this can take a couple minutes to run

setlist = [
    "4ED",
    "ICE",
    "CHR",
    "HML",
    "ALL",
    "MIR",
    "VIS",
    "5ED",
    "WTH",
    "POR",
    "TMP",
    "STH",
    "EXO",
    "P02",
    "USG",
    "ULG",
    "6ED",
    "UDS",
    "PTK",
    "S99",
    "MMQ",
    "NEM",
    "PCY",
    "S00",
    "INV",
    "PLS",
    "7ED",
    "APC",
    "ODY",
    "TOR",
    "JUD",
    "ONS",
    "LGN",
    "SCG",
    "PDRC",
    "PHPR",
    "ATH",
    "BRB",
    "BTD",
    "DKM",
]
with open("list_scripts/3_separate_json_files_per_set.sh", "w") as f:
    for set in setlist:
        # Write a separate JSON document for each Middle School legal set
        line = f"cat data/AllPrintings.json | jq '.data.\"{set}\".cards' > data/set_{set}.json"
        f.write(line + "\n")
    line = "jq -s add data/set_* > data/middleschool.json"
    f.write(line + "\n")