Beispiel #1
0
def reload_data():
    global patch, reverse_patch, uri_map, uri_patch
    patch = {}
    reverse_patch = {}
    uri_map = {}
    uri_patch = {}

    graph = showconfig.getGraph()

    for chan in graph.subjects(RDF.type, L9['Channel']):
        for which, name in enumerate([graph.label(chan)] +
                                     list(graph.objects(chan, L9['altName']))):
            name = str(name)
            uri_map[name] = chan

            if name in patch:
                raise ValueError("channel name %r used multiple times" % name)
            for output in graph.objects(chan, L9['output']):
                for addr in graph.objects(output, L9['dmxAddress']):
                    addrInt = int(addr)
                    patch[name] = addrInt
                    uri_patch[chan] = addrInt

                    if which == 0:
                        reverse_patch[addrInt] = name
                        reverse_patch[addr] = name
                        norm_name = name
                    else:
                        reverse_patch[name] = norm_name