Created
June 7, 2014 16:36
-
-
Save Yepoleb/ac9e09a83ba90115fe90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mysql.connector as mysql | |
import yaml | |
filepath = "warps/" | |
conn = mysql.connect(user="", password="", | |
host="localhost", database="mc_global_gesuit") | |
print("Fetching data") | |
cur = conn.cursor() | |
cur.execute("SELECT * FROM warps") | |
warptable = cur.fetchall() | |
print("Processing data") | |
warpfiles = [] | |
for row in warptable: | |
warpname = row[0] | |
world = row[2] | |
x = row[3] | |
y = row[4] | |
z = row[5] | |
yaw = row[6] | |
pitch = row[7] | |
warpfiles.append({ | |
"world": world, | |
"x": x, | |
"y": y, | |
"z": z, | |
"yaw": yaw, | |
"pitch": pitch, | |
"name": warpname}) | |
print("Dumping warps") | |
for warp in warpfiles: | |
warppath = filepath + warp["name"] + ".yml" | |
f = open(warppath, "w") | |
yaml.dump(warp, f, default_flow_style=False) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment