magictk/photo2/run.py

21 lines
642 B
Python

import os
import pickle
import base64
paths = os.path.dirname(__file__).replace("\\", "/")
pickle_jar = {}
print("packing...")
for i in os.listdir(paths+"/res"):
if (".pack" in i):
print(f"insert {i}")
with open(paths+"/res/"+i, "rb") as file:
pkg_jar = pickle.load(file)
pickle_jar.update(pkg_jar)
else:
print(f"pack {i}")
with open(paths+"/res/"+i, "rb") as file:
pickle_jar[i.split(".")[0]] = base64.b64encode(file.read())
print("write...")
with open(paths+"/../magictk/res.pickle", "wb") as file:
pickle.dump(pickle_jar, file)
print("done!")