Added SQLiteExact script
0
minetestforfun_game/mods/stairs/models/stairs.obj
Normal file → Executable file
0
mods/arrow_signs/models/arrow_sign.obj
Normal file → Executable file
0
mods/warps/LICENSE
Normal file → Executable file
0
mods/warps/README
Normal file → Executable file
0
mods/warps/depends.txt
Normal file → Executable file
0
mods/warps/description.txt
Normal file → Executable file
0
mods/warps/init.lua
Normal file → Executable file
0
mods/warps/models/warps_warpstone.obj
Normal file → Executable file
0
mods/warps/sounds/LICENSE
Normal file → Executable file
0
mods/warps/sounds/warps_plop.ogg
Normal file → Executable file
0
mods/warps/sounds/warps_woosh.ogg
Normal file → Executable file
0
mods/warps/textures/warps_warpstone.png
Normal file → Executable file
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
0
mods/warps/textures/warps_warpstone_guide.png
Normal file → Executable file
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 199 B |
0
mods/watershed/README.txt
Normal file → Executable file
0
mods/watershed/depends.txt
Normal file → Executable file
0
mods/watershed/functions.lua
Normal file → Executable file
0
mods/watershed/init.lua
Normal file → Executable file
0
mods/watershed/license.txt
Normal file → Executable file
0
mods/watershed/nodes.lua
Normal file → Executable file
0
mods/watershed/textures/watershed_acacialeaf.png
Normal file → Executable file
Before Width: | Height: | Size: 340 B After Width: | Height: | Size: 340 B |
0
mods/watershed/textures/watershed_acacialing.png
Normal file → Executable file
Before Width: | Height: | Size: 359 B After Width: | Height: | Size: 359 B |
0
mods/watershed/textures/watershed_acaciatree.png
Normal file → Executable file
Before Width: | Height: | Size: 682 B After Width: | Height: | Size: 682 B |
0
mods/watershed/textures/watershed_acaciatreetop.png
Normal file → Executable file
Before Width: | Height: | Size: 731 B After Width: | Height: | Size: 731 B |
0
mods/watershed/textures/watershed_acaciawood.png
Normal file → Executable file
Before Width: | Height: | Size: 364 B After Width: | Height: | Size: 364 B |
0
mods/watershed/textures/watershed_bucketfreshwater.png
Normal file → Executable file
Before Width: | Height: | Size: 330 B After Width: | Height: | Size: 330 B |
0
mods/watershed/textures/watershed_cloud.png
Normal file → Executable file
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 136 B |
0
mods/watershed/textures/watershed_drygrass.png
Normal file → Executable file
Before Width: | Height: | Size: 771 B After Width: | Height: | Size: 771 B |
0
mods/watershed/textures/watershed_freshice.png
Normal file → Executable file
Before Width: | Height: | Size: 780 B After Width: | Height: | Size: 780 B |
0
mods/watershed/textures/watershed_freshwater.png
Normal file → Executable file
Before Width: | Height: | Size: 713 B After Width: | Height: | Size: 713 B |
0
mods/watershed/textures/watershed_freshwateranim.png
Normal file → Executable file
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
0
mods/watershed/textures/watershed_freshwaterflowanim.png
Normal file → Executable file
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
0
mods/watershed/textures/watershed_goldengrass.png
Normal file → Executable file
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 683 B |
0
mods/watershed/textures/watershed_icydirt.png
Normal file → Executable file
Before Width: | Height: | Size: 746 B After Width: | Height: | Size: 746 B |
0
mods/watershed/textures/watershed_light.png
Normal file → Executable file
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 155 B |
0
mods/watershed/textures/watershed_luxcrystal.png
Normal file → Executable file
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 207 B |
0
mods/watershed/textures/watershed_luxore.png
Normal file → Executable file
Before Width: | Height: | Size: 311 B After Width: | Height: | Size: 311 B |
0
mods/watershed/textures/watershed_mixwater.png
Normal file → Executable file
Before Width: | Height: | Size: 716 B After Width: | Height: | Size: 716 B |
0
mods/watershed/textures/watershed_mixwateranim.png
Normal file → Executable file
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
0
mods/watershed/textures/watershed_mixwaterflowanim.png
Normal file → Executable file
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
0
mods/watershed/textures/watershed_needles.png
Normal file → Executable file
Before Width: | Height: | Size: 860 B After Width: | Height: | Size: 860 B |
0
mods/watershed/textures/watershed_permafrost.png
Normal file → Executable file
Before Width: | Height: | Size: 897 B After Width: | Height: | Size: 897 B |
0
mods/watershed/textures/watershed_pineling.png
Normal file → Executable file
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 406 B |
0
mods/watershed/textures/watershed_pinetree.png
Normal file → Executable file
Before Width: | Height: | Size: 693 B After Width: | Height: | Size: 693 B |
0
mods/watershed/textures/watershed_pinetreetop.png
Normal file → Executable file
Before Width: | Height: | Size: 802 B After Width: | Height: | Size: 802 B |
0
mods/watershed/textures/watershed_pinewood.png
Normal file → Executable file
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 366 B |
0
mods/watershed/textures/watershed_redcobble.png
Normal file → Executable file
Before Width: | Height: | Size: 686 B After Width: | Height: | Size: 686 B |
149
other_things/scripts/SQLextract.py
Executable file
@ -0,0 +1,149 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 -*-
|
||||
|
||||
import sys, os, sqlite3
|
||||
|
||||
home = os.environ.get("HOME")
|
||||
db = "%s/rollback/rollback.sqlite" % (home)
|
||||
|
||||
|
||||
def select_all_nodes(stamp):
|
||||
try:
|
||||
conn = sqlite3.connect(db)
|
||||
conn.text_factory = str
|
||||
cur = conn.cursor()
|
||||
except sqlite3.OperationalError as err:
|
||||
print(err)
|
||||
sys.exit(1)
|
||||
try:
|
||||
cur.execute("SELECT * FROM action WHERE timestamp >=:stamp", {"stamp":stamp})
|
||||
except sqlite3.OperationalError as err:
|
||||
print(err)
|
||||
sys.exit(1)
|
||||
else:
|
||||
result = cur.fetchall()
|
||||
finally:
|
||||
cur.close()
|
||||
conn.close()
|
||||
return(result)
|
||||
|
||||
|
||||
|
||||
|
||||
def select_nodes_id():
|
||||
try:
|
||||
conn = sqlite3.connect(db)
|
||||
cur = conn.cursor()
|
||||
except sqlite3.OperationalError as err:
|
||||
print(err)
|
||||
sys.exit(1)
|
||||
try:
|
||||
cur.execute("SELECT * FROM node")
|
||||
except sqlite3.OperationalError as err:
|
||||
print(err)
|
||||
sys.exit(1)
|
||||
else:
|
||||
result = cur.fetchall()
|
||||
finally:
|
||||
cur.close()
|
||||
conn.close()
|
||||
return(result)
|
||||
|
||||
|
||||
def get_node(nodeid):
|
||||
if not nodeid:
|
||||
return None
|
||||
try:
|
||||
return select_nodes_id()[nodeid-1][1]
|
||||
except IndexError:
|
||||
print(nodeid)
|
||||
|
||||
|
||||
def select_player_id(table, player_name):
|
||||
try:
|
||||
conn = sqlite3.connect(db)
|
||||
cur = conn.cursor()
|
||||
except:
|
||||
print("Problème avec la base de données")
|
||||
return("")
|
||||
try:
|
||||
cur.execute("SELECT id FROM " + str(table) + " WHERE name=:name", {"name": "player:%s" % player_name})
|
||||
except sqlite3.OperationalError as err:
|
||||
print(err)
|
||||
return ("")
|
||||
else:
|
||||
result = cur.fetchall()
|
||||
finally:
|
||||
cur.close()
|
||||
conn.close()
|
||||
return(result)
|
||||
|
||||
def get_player(id):
|
||||
try:
|
||||
conn = sqlite3.connect(db)
|
||||
cur = conn.cursor()
|
||||
except:
|
||||
print("problème avec la base de données")
|
||||
return ("")
|
||||
try:
|
||||
cur.execute("SELECT name from actor WHERE id=%d" % id)
|
||||
except sqlite3.OperationalError as err:
|
||||
print(err)
|
||||
return ("")
|
||||
else:
|
||||
result = cur.fetchall()[0][0]
|
||||
finally:
|
||||
cur.close()
|
||||
conn.close()
|
||||
return result[len("player:"):]
|
||||
|
||||
|
||||
def ston(a):
|
||||
if a:
|
||||
return str(a)
|
||||
else:
|
||||
return a
|
||||
|
||||
def write_list(nodes):
|
||||
try:
|
||||
name = "database-output.txt"
|
||||
f = open(name, "w")
|
||||
except Exception as err:
|
||||
print(err)
|
||||
sys.exit(1)
|
||||
|
||||
for node in nodes:
|
||||
f.write("[")
|
||||
f.write("id=%d" % node[0])
|
||||
f.write(";actor=%s" % get_player(node[1]))
|
||||
f.write(";type=%d" % node[3])
|
||||
f.write(";list=%s" % ston(node[4]))
|
||||
f.write(",index=%s" % ston(node[5]))
|
||||
f.write(",add=%s" % ston(node[6]))
|
||||
f.write(",stacknode=%s" % get_node(node[7]))
|
||||
f.write(",stackquantity=%s" % ston(node[8]))
|
||||
f.write(",nodemeta=%s" % ston(node[9]))
|
||||
f.write(";x=%s,y=%s,z=%s" % (node[10], node[11], node[12]))
|
||||
f.write(";oldnode=%s" % get_node(node[13]))
|
||||
f.write(",oldparam1=%s" % node[14])
|
||||
f.write(",oldparam2=%s" % ston(node[15]))
|
||||
f.write(",oldmeta=%s" % ston(node[16]))
|
||||
f.write(":newnode=%s" % get_node(node[17]))
|
||||
f.write(",newparam1=%s" % ston(node[18]))
|
||||
f.write(",newparam2=%s" % ston(node[19]))
|
||||
f.write(",newmeta=%s" % ston(node[20]))
|
||||
f.write("]\n")
|
||||
|
||||
f.close()
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
#select all nodes player as set i where time >= time
|
||||
all_nodes = select_all_nodes(0) #1418613979)
|
||||
|
||||
# write in file
|
||||
# for x in range(0,len(all_nodes)):
|
||||
# print(all_nodes[x])
|
||||
write_list(all_nodes)
|