2020-09-27 12:22:10 -05:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import json
|
|
|
|
import os
|
|
|
|
|
|
|
|
updir = "CustomUploaders"
|
|
|
|
files = [f for f in os.listdir(updir) if os.path.isfile("{0}/{1}".format(updir, f))]
|
|
|
|
|
|
|
|
files2 = [f for f in files if f.endswith(".sxcu")]
|
|
|
|
|
|
|
|
for fname in files2:
|
|
|
|
with open("{0}/{1}".format(updir, fname), "r", encoding="utf-8-sig") as f:
|
|
|
|
rawjson = f.read()
|
|
|
|
|
|
|
|
conv = json.loads(rawjson)
|
|
|
|
|
2020-09-27 12:29:42 -05:00
|
|
|
if "FileFormName" in conv.keys():
|
|
|
|
try:
|
|
|
|
conv.pop("Version")
|
|
|
|
except KeyError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
try:
|
|
|
|
conv.pop("Name")
|
|
|
|
except KeyError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
try:
|
|
|
|
conv.pop("DestinationType")
|
|
|
|
except KeyError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
with open("{0}/{1}".format(updir + "-converted", fname), "w+") as f:
|
|
|
|
f.write(json.dumps(conv))
|
|
|
|
|
|
|
|
else:
|
|
|
|
print("Skipped {0}".format(fname))
|