From 0dfe56062172d2ac81daa5399e7e9b4ffffcacf1 Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Mon, 21 Mar 2016 16:12:51 -0400 Subject: [PATCH] working on leveldb numpy issues and adding more to colors-missing.txt --- colors-missing.txt | 2 ++ minetestmapper-numpy.py | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/colors-missing.txt b/colors-missing.txt index abbbea8..f2ff63e 100644 --- a/colors-missing.txt +++ b/colors-missing.txt @@ -187,3 +187,5 @@ seaplants:seaplantssandkelpbrown youngtrees:youngtree_top seacoral:seacoraldirtredviolet seaplants:seaplantssandseagrassred +meze:meze +default:junglewood diff --git a/minetestmapper-numpy.py b/minetestmapper-numpy.py index 777e9c9..dfc6986 100644 --- a/minetestmapper-numpy.py +++ b/minetestmapper-numpy.py @@ -445,6 +445,7 @@ class SQLDB: self.cur.execute("SELECT `pos` FROM `blocks`") while True: r = self.cur.fetchone() + print("getting int from first index of value "+str(r)) if not r: break x, y, z = getIntegerAsBlock(r[0]) @@ -466,10 +467,16 @@ class LVLDB: for k in self.conn.RangeIter(): #if k is not None and len(k)>0: try: - x, y, z = getIntegerAsBlock(int(k[0])) + val = k[0] + if k[0][:2]=="\\x": + #in leveldb, minetest stores \x before every byte of the value, so remove all and prepend 0x so python can convert to int + val = "\\0x" + k[0].replace("\\x", "") + x, y, z = getIntegerAsBlock(int(val)) yield x, y, z, k[0] except: - print("WARNING: no int at first index in value '"+str(k)) + print("Could not finish getting int from first index of value "+str(k)) + #prints tons of output such as Could not finish getting int from first index of value ('\x00\x00\x00\x0e\x00\x02\x85 ', '\x19\x08\x02\x02x\x9c\xed\xc11\x01\x00\x00\x00\xc2\xa0\xf5Om\x0c\x1f\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xb7\x01@\x00\x00\x01x\x9cc\x00\x00\x00\x01\x00\x01\x00\x00\x00\xff\xff\xff\xff\x00\x00\x01\x00\x00\x00\x06ignore\n\x00\x00') + def get(self, pos): return BytesIO(self.conn.Get(pos))