28 lines
641 B
Python
28 lines
641 B
Python
import json
|
|
|
|
def do():
|
|
data = json.loads(open("radia.json").read())
|
|
ids = json.loads(open("idmapping.json").read())
|
|
lines = {}
|
|
for i in ids.keys():
|
|
if not i.endswith("box"):
|
|
lines[i] = []
|
|
for d in data:
|
|
print d
|
|
if data[d].has_key('lines'):
|
|
linestring = data[d]['lines']
|
|
else:
|
|
linestring = ''
|
|
theseLines = linestring.split(",")
|
|
for t in theseLines:
|
|
t = t.strip()
|
|
if t != '':
|
|
if lines.has_key(t):
|
|
lines[t].append(d)
|
|
else:
|
|
print t
|
|
out = open("linemapping.js", "w")
|
|
out.write("LINES = " + json.dumps(lines, indent=2))
|
|
out.close()
|
|
|