You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

27 lines
662 B

import json
def do():
data = json.loads(open("radia.json").read())
ids = json.loads(open("idmapping.js").read().replace("RIDS = ", ""))
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()