def print_tsv(filename, allchans, subs): f = open(filename, "w") print >> f, "\t" + "\t".join(allchans) for name, levels in subs.items(): normd = {} # nrmalize the names in the sub for k, v in levels.items(): normd[Patch.resolve_name(k)] = v print >> f, "%s\t%s" % (name, "\t".join([str(normd.get(c, "")) for c in allchans]))
'2-01' : 'hotbox', '2-02' : 'more can i wish you', '2-03' : 'sewer (crap game)', '2-04' : 'sue me', '2-05' : 'rock the boat (int. mission)', '2-06' : 'marry (trav)', '2-07' : 'finale (broadway)', } sub_to_scene = {} # blacklist is a list of *prefixes* to light names that won't be shown blacklist = 'god upfill red blue cyc oran sidefill'.split() blacklist.extend(['side l','side r']) for subname, levdict in subs.items(): if type(subname) == TupleType: subname = subname[0] oldname = subname subname = re.sub(r'\*(\d-\d+)-.*', r'\1', subname) if oldname == subname: continue sub_to_scene[oldname] = subname subname = oldname # restore 'em. restore 'em good. if not levdict: print "Warning: %s is useless (empty sub)." % subname else: for ch, lev in levdict.items(): if lev: ch = resolve_name(ch) subusage.setdefault(ch, []) subusage[ch].append((lev, subname))