1
0
mirror of synced 2024-11-30 17:04:28 +01:00
GC-local-server-rewrite/doc/genunlock.py
2023-03-03 19:03:13 +08:00

25 lines
580 B
Python

import csv
import sqlite3
import json
con = sqlite3.connect('music471omni.db3')
cur = con.cursor()
id = 6
with open('unlockables.csv', encoding='utf8') as csvfile:
reader = csv.reader(csvfile, delimiter=',')
for row in reader:
name = row[0]
res = cur.execute("SELECT music_id FROM music_unlock where title=:t", {"t":name})
for music_id in res:
config = {
"RewardId": id,
"RewardType": "Music",
"TargetId": music_id[0],
"TargetNum": 1,
"KeyNum": 1
}
id += 1
print(json.dumps(config, indent=4) + ",")