Ryan Fox
67f9bb49c0
Requires the json and sqlite3 modules. I think these are installed by default, but don't quote me on that.
15 lines
410 B
Python
Executable File
15 lines
410 B
Python
Executable File
#!/usr/bin/env python3
|
|
import json
|
|
import sqlite3
|
|
with open("2a03.json", "r") as f:
|
|
config = json.loads(f.read())
|
|
sql = "INSERT INTO players (uuid, home) VALUES "
|
|
def sql_values(player):
|
|
return "('"+player["uuid"]+"', '"+json.dumps(player["home"])+"')"
|
|
sql += ", ".join(list(map(sql_values, config["members"])))
|
|
sql += ";"
|
|
conn = sqlite3.connect("2a03.db")
|
|
conn.execute(sql)
|
|
conn.commit()
|
|
conn.close()
|