changeset 1998:3d28b1a54a29

reformat Ignore-this: 28e00687983432a552e465291ef9b4b4
author drewp@bigasterisk.com
date Sun, 09 Jun 2019 21:56:03 +0000
parents 3b7ff54a41a9
children b8efe756ad5d
files bin/collector bin/patchserver
diffstat 2 files changed, 26 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/bin/collector	Sun Jun 09 21:53:03 2019 +0000
+++ b/bin/collector	Sun Jun 09 21:56:03 2019 +0000
@@ -68,7 +68,10 @@
         # 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:
--- a/bin/patchserver	Sun Jun 09 21:53:03 2019 +0000
+++ b/bin/patchserver	Sun Jun 09 21:56:03 2019 +0000
@@ -27,29 +27,33 @@
 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 @@
         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",