File size: 1,003 Bytes
9bd4ce5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import json


def dump_compiled_cards():
    target_ids = {294, 384, 430, 258, 261}

    try:
        with open("data/cards_compiled.json", "r", encoding="utf-8") as f:
            data = json.load(f)
    except Exception as e:
        print(f"Error: {e}")
        return

    found = {}

    # Check both member_db and live_db
    databases = ["member_db", "live_db"]

    for db_name in databases:
        if db_name in data:
            db = data[db_name]
            for card_id_str, card_data in db.items():
                try:
                    cid = int(card_id_str)
                    if cid in target_ids:
                        found[cid] = card_data
                except ValueError:
                    continue

    # Write to file
    with open("compiled_cards_dump.json", "w", encoding="utf-8") as f:
        json.dump(found, f, indent=2, ensure_ascii=False)
    print(f"Dumped {len(found)} cards to compiled_cards_dump.json")


if __name__ == "__main__":
    dump_compiled_cards()