diff --git a/bin/effectsequencer b/bin/effectsequencer --- a/bin/effectsequencer +++ b/bin/effectsequencer @@ -17,7 +17,9 @@ from light9.collector.collector_client i from light9 import clientsession + class App(object): + def __init__(self, show, session): self.show = show self.session = session @@ -25,23 +27,25 @@ class App(object): self.graph = SyncedGraph(networking.rdfdb.url, "effectSequencer") self.graph.initiallySynced.addCallback(self.launch) + self.stats = scales.collection( + '/', + scales.PmfStat('sendLevels'), + scales.PmfStat('getMusic'), + scales.PmfStat('evals'), + scales.PmfStat('sendOutput'), + scales.IntStat('errors'), + ) - self.stats = scales.collection('/', - scales.PmfStat('sendLevels'), - scales.PmfStat('getMusic'), - scales.PmfStat('evals'), - scales.PmfStat('sendOutput'), - scales.IntStat('errors'), - ) def launch(self, *args): self.seq = Sequencer( - self.graph, - lambda settings: sendToCollector('effectSequencer', self.session, - settings)) + self.graph, lambda settings: sendToCollector( + 'effectSequencer', self.session, settings)) self.cycloneApp = cyclone.web.Application(handlers=[ - (r'/()', cyclone.web.StaticFileHandler, - {"path" : "light9/effect/", "default_filename" : "sequencer.html"}), + (r'/()', cyclone.web.StaticFileHandler, { + "path": "light9/effect/", + "default_filename": "sequencer.html" + }), (r'/updates', Updates), (r'/stats', StatsForCyclone), ], @@ -55,12 +59,16 @@ class App(object): if __name__ == "__main__": parser = optparse.OptionParser() - parser.add_option('--show', + parser.add_option( + '--show', help='show URI, like http://light9.bigasterisk.com/show/dance2008', - default=showconfig.showUri()) - parser.add_option("-v", "--verbose", action="store_true", + default=showconfig.showUri()) + parser.add_option("-v", + "--verbose", + action="store_true", help="logging.DEBUG") - parser.add_option("--twistedlog", action="store_true", + parser.add_option("--twistedlog", + action="store_true", help="twisted logging") clientsession.add_option(parser) (options, args) = parser.parse_args() @@ -68,7 +76,7 @@ if __name__ == "__main__": if not options.show: raise ValueError("missing --show http://...") - + session = clientsession.getUri('effectSequencer', options) app = App(URIRef(options.show), session)