magictk/photo2/run.py

21 lines
642 B
Python
Raw Normal View History

2024-03-24 18:16:29 +08:00
import os
import pickle
import base64
paths = os.path.dirname(__file__).replace("\\", "/")
pickle_jar = {}
print("packing...")
for i in os.listdir(paths+"/res"):
2024-04-25 22:50:51 +08:00
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())
2024-03-24 18:16:29 +08:00
print("write...")
with open(paths+"/../magictk/res.pickle", "wb") as file:
pickle.dump(pickle_jar, file)
print("done!")