Mercurial > code > home > repos > light9
annotate bin/effectsequencer @ 2043:67575505c400
comment out more greplin so services can start
author | drewp@bigasterisk.com |
---|---|
date | Mon, 09 May 2022 23:18:05 -0700 |
parents | f29e26811206 |
children | 9aa046cc9b33 |
rev | line source |
---|---|
1373 | 1 #!bin/python |
2 """ | |
3 plays back effect notes from the timeline | |
4 """ | |
1859
f066d6e874db
2to3 with these fixers: all idioms set_literal
drewp@bigasterisk.com
parents:
1858
diff
changeset
|
5 |
1373 | 6 from run_local import log |
7 from twisted.internet import reactor | |
2043
67575505c400
comment out more greplin so services can start
drewp@bigasterisk.com
parents:
1937
diff
changeset
|
8 # from greplin.scales.cyclonehandler import StatsHandler |
1692 | 9 from rdfdb.syncedgraph import SyncedGraph |
1373 | 10 from light9 import networking, showconfig |
2043
67575505c400
comment out more greplin so services can start
drewp@bigasterisk.com
parents:
1937
diff
changeset
|
11 # from greplin import scales |
1373 | 12 import optparse, sys, logging |
13 import cyclone.web | |
14 from rdflib import URIRef | |
1830 | 15 from light9.effect.sequencer import Sequencer, Updates |
16 from light9.collector.collector_client import sendToCollector | |
17 | |
1698
f140153c087c
bring back clientsession which doesn't belong in rdfdb
Drew Perttula <drewp@bigasterisk.com>
parents:
1692
diff
changeset
|
18 from light9 import clientsession |
1373 | 19 |
1858 | 20 |
1373 | 21 class App(object): |
1858 | 22 |
1373 | 23 def __init__(self, show, session): |
24 self.show = show | |
25 self.session = session | |
26 | |
27 self.graph = SyncedGraph(networking.rdfdb.url, "effectSequencer") | |
28 self.graph.initiallySynced.addCallback(self.launch) | |
29 | |
2043
67575505c400
comment out more greplin so services can start
drewp@bigasterisk.com
parents:
1937
diff
changeset
|
30 # self.stats = scales.collection( |
67575505c400
comment out more greplin so services can start
drewp@bigasterisk.com
parents:
1937
diff
changeset
|
31 # '/', |
67575505c400
comment out more greplin so services can start
drewp@bigasterisk.com
parents:
1937
diff
changeset
|
32 # scales.PmfStat('sendLevels', recalcPeriod=1), |
67575505c400
comment out more greplin so services can start
drewp@bigasterisk.com
parents:
1937
diff
changeset
|
33 # scales.PmfStat('getMusic', recalcPeriod=1), |
67575505c400
comment out more greplin so services can start
drewp@bigasterisk.com
parents:
1937
diff
changeset
|
34 # scales.PmfStat('evals', recalcPeriod=1), |
67575505c400
comment out more greplin so services can start
drewp@bigasterisk.com
parents:
1937
diff
changeset
|
35 # scales.PmfStat('sendOutput', recalcPeriod=1), |
67575505c400
comment out more greplin so services can start
drewp@bigasterisk.com
parents:
1937
diff
changeset
|
36 # scales.IntStat('errors'), |
67575505c400
comment out more greplin so services can start
drewp@bigasterisk.com
parents:
1937
diff
changeset
|
37 # ) |
1373 | 38 |
39 def launch(self, *args): | |
1391
4a7594476905
hack up KC so it edits effect strengths instead
Drew Perttula <drewp@bigasterisk.com>
parents:
1373
diff
changeset
|
40 self.seq = Sequencer( |
1927 | 41 self.graph, |
42 lambda settings: sendToCollector( | |
43 'effectSequencer', | |
44 self.session, | |
45 settings, | |
1924
91bcc6c76934
sequencer can use zmq, it seems, but KC should not
Drew Perttula <drewp@bigasterisk.com>
parents:
1859
diff
changeset
|
46 # This seems to be safe here (and lets us get from |
91bcc6c76934
sequencer can use zmq, it seems, but KC should not
Drew Perttula <drewp@bigasterisk.com>
parents:
1859
diff
changeset
|
47 # 20fpx to 40fpx), even though it leads to big stalls |
91bcc6c76934
sequencer can use zmq, it seems, but KC should not
Drew Perttula <drewp@bigasterisk.com>
parents:
1859
diff
changeset
|
48 # if I use it on KC. |
91bcc6c76934
sequencer can use zmq, it seems, but KC should not
Drew Perttula <drewp@bigasterisk.com>
parents:
1859
diff
changeset
|
49 useZmq=True)) |
1373 | 50 |
51 self.cycloneApp = cyclone.web.Application(handlers=[ | |
1858 | 52 (r'/()', cyclone.web.StaticFileHandler, { |
53 "path": "light9/effect/", | |
54 "default_filename": "sequencer.html" | |
55 }), | |
1776 | 56 (r'/updates', Updates), |
2043
67575505c400
comment out more greplin so services can start
drewp@bigasterisk.com
parents:
1937
diff
changeset
|
57 # (r'/stats/(.*)', StatsHandler, { |
67575505c400
comment out more greplin so services can start
drewp@bigasterisk.com
parents:
1937
diff
changeset
|
58 # 'serverName': 'effectsequencer' |
67575505c400
comment out more greplin so services can start
drewp@bigasterisk.com
parents:
1937
diff
changeset
|
59 # }), |
1373 | 60 ], |
61 debug=True, | |
1776 | 62 seq=self.seq, |
1373 | 63 graph=self.graph, |
2043
67575505c400
comment out more greplin so services can start
drewp@bigasterisk.com
parents:
1937
diff
changeset
|
64 # stats=self.stats |
67575505c400
comment out more greplin so services can start
drewp@bigasterisk.com
parents:
1937
diff
changeset
|
65 ) |
1373 | 66 reactor.listenTCP(networking.effectSequencer.port, self.cycloneApp) |
67 log.info("listening on %s" % networking.effectSequencer.port) | |
68 | |
69 | |
70 if __name__ == "__main__": | |
71 parser = optparse.OptionParser() | |
1858 | 72 parser.add_option( |
73 '--show', | |
1373 | 74 help='show URI, like http://light9.bigasterisk.com/show/dance2008', |
1858 | 75 default=showconfig.showUri()) |
76 parser.add_option("-v", | |
77 "--verbose", | |
78 action="store_true", | |
1373 | 79 help="logging.DEBUG") |
1858 | 80 parser.add_option("--twistedlog", |
81 action="store_true", | |
1373 | 82 help="twisted logging") |
83 clientsession.add_option(parser) | |
84 (options, args) = parser.parse_args() | |
85 log.setLevel(logging.DEBUG if options.verbose else logging.INFO) | |
86 | |
87 if not options.show: | |
88 raise ValueError("missing --show http://...") | |
1858 | 89 |
1373 | 90 session = clientsession.getUri('effectSequencer', options) |
91 | |
92 app = App(URIRef(options.show), session) | |
93 if options.twistedlog: | |
94 from twisted.python import log as twlog | |
95 twlog.startLogging(sys.stderr) | |
96 reactor.run() |