pitch-dark/bin/textnormalize.py

27 lines
865 B
Python
Raw Permalink Normal View History

#!/usr/bin/env python3
import sys
fileinfo = []
for f in sys.argv[1:]:
linelength = 0
with open(f) as buffer:
lines = buffer.readlines()
2018-02-21 21:02:26 +00:00
shortf = f.replace(".txt", "").replace("res/text/", "").upper()
newf = "build/TEXT/" + shortf
fileinfo.append(shortf + "=Type(04),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(C3)")
with open(newf, 'w') as buffer:
for l in lines:
l = l[:-1]
if not l:
linelength = 0
if l and linelength:
l = l + ' '*(linelength-len(l))
2018-03-27 19:19:48 +00:00
buffer.write(l + "\r")
if l.startswith("[info]"):
2018-02-24 20:25:41 +00:00
linelength = 64
elif l.startswith("[description]"):
linelength = 77
with open("build/TEXT/_FileInformation.txt", "w") as infobuff:
infobuff.write("\r\n".join(fileinfo))