magictk/photo2/run.py
2024-03-24 18:22:26 +08:00

15 lines
437 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"):
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!")