-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdictionary_gly2json.py
More file actions
26 lines (26 loc) · 958 Bytes
/
dictionary_gly2json.py
File metadata and controls
26 lines (26 loc) · 958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
import json
d = []
i = 0
with open("dictionary.gly", "r") as fi:
for line in fi:
if "++" != line[:2]:
line = line.split("-!")[0]
h, line = line.split("-+t")
t, line = line.split("+s-+l")
e, line = line.split("+s")
filename = "dict%d"%i
d.append({
'hieroglyph': h.strip(),
'filename': filename,
'transcription': t.strip(),
'translation': e.strip(),
})
os.system("mv dictionary/img%d.png dictionary/dict%d.png 2>/dev/null"%(i,i))
print(filename ,h, t, e)
i +=1
print("dumping json..")
with open("../Middle Egyptian/Middle Egyptian/Shared/dictionary.json", "w") as f:
json.dump(d,f, indent=4)
print("xcassets...")
os.system("""xcassetpacker --input "dictionary" --output "../Middle Egyptian/Middle Egyptian/Shared/Dictionary.xcassets" --force""")