# HG changeset patch # User drewp@bigasterisk.com # Date 2019-06-09 21:56:03 # Node ID 3d28b1a54a291165451bc5cad577a9f0cb07d40f # Parent 3b7ff54a41a9a2ed04100ba66ecf231149fad606 reformat Ignore-this: 28e00687983432a552e465291ef9b4b4 diff --git a/bin/collector b/bin/collector --- a/bin/collector +++ b/bin/collector @@ -68,7 +68,10 @@ def launch(graph, doLoadTest=False): # todo: drive outputs with config files rate = 30 outputs = [ - ArtnetDmx(L9['output/dmxA/'], host='127.0.0.1', port=6445, rate=rate), + ArtnetDmx(L9['output/dmxA/'], + host='127.0.0.1', + port=6445, + rate=rate), #DummyOutput(L9['output/dmxA/']), ] except Exception: diff --git a/bin/patchserver b/bin/patchserver --- a/bin/patchserver +++ b/bin/patchserver @@ -27,29 +27,33 @@ from rdfdb.patch import Patch stats = scales.collection('/webServer', scales.PmfStat('setAttr', recalcPeriod=1)) + def launch(graph): if 0: - reactor.listenTCP(networking.captureDevice.port, - cyclone.web.Application(handlers=[ - (r'/()', cyclone.web.StaticFileHandler, { - "path": "light9/web", - "default_filename": "patchServer.html" - }), - (r'/stats/(.*)', StatsHandler, { - 'serverName': 'patchServer' - }), - ]), - interface='::', - ) + reactor.listenTCP( + networking.captureDevice.port, + cyclone.web.Application(handlers=[ + (r'/()', cyclone.web.StaticFileHandler, { + "path": "light9/web", + "default_filename": "patchServer.html" + }), + (r'/stats/(.*)', StatsHandler, { + 'serverName': 'patchServer' + }), + ]), + interface='::', + ) log.info('serving http on %s', networking.captureDevice.port) def prn(): width = {} for dc in graph.subjects(RDF.type, L9['DeviceClass']): for attr in graph.objects(dc, L9['attr']): - width[dc] = max(width.get(dc, 0), graph.value(attr, L9['dmxOffset']).toPython() + 1) - - user = {} # chan: [dev] + width[dc] = max( + width.get(dc, 0), + graph.value(attr, L9['dmxOffset']).toPython() + 1) + + user = {} # chan: [dev] for dev in set(graph.subjects(L9['dmxBase'], None)): dc = graph.value(dev, RDF.type) base = graph.value(dev, L9['dmxBase']).toPython() @@ -60,8 +64,10 @@ def launch(graph): for chan in range(1, max(user) + 1): dev = user.get(chan, None) print(f'chan {chan} used by {dev}') + graph.addHandler(prn) - + + def main(): parser = optparse.OptionParser() parser.add_option("-v",