-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcombinedInspector.py
executable file
·32 lines (30 loc) · 1.12 KB
/
combinedInspector.py
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
27
28
29
30
31
32
#!/usr/bin/python
from terrainInspector import drawTerrain
from objectInspector import writeRegionObjects
from split import getRegionCount
from PIL import Image
import sys, tarfile
if __name__ == "__main__":
if len(sys.argv) < 2:
print "Error usage: oarSplitter.py filename.oar"
exit(1)
for oarFile in sys.argv[1:]:
try:
valid = tarfile.is_tarfile(oarFile)
if valid:
tf = tarfile.open(oarFile, mode="r:gz")
if tf.firstmember.name == "archive.xml":
count = getRegionCount(tf)
if count < 1:
print "This is not a var-region archive, refusing to split"
else:
img = drawTerrain(tf, count)
writeRegionObjects(tf, img)
img = img.transpose(Image.FLIP_TOP_BOTTOM)
img.show(title=oarFile)
else:
print "invalid oar file"
else:
print "invalid oar file"
except IOError, err:
print '%20s %s' % (oarFile, err)