Mercurial > code > home > repos > light9
annotate bin/effectsequencer @ 2049:1aa9a1293611
asco gets a better launcher with vite in it
author | drewp@bigasterisk.com |
---|---|
date | Wed, 11 May 2022 00:06:19 -0700 |
parents | 9aa046cc9b33 |
children |
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 | |
2046
9aa046cc9b33
replace greplin with prometheus throughout (untested)
drewp@bigasterisk.com
parents:
2043
diff
changeset
|
8 from light9.metrics import metrics, metricsRoute |
1692 | 9 from rdfdb.syncedgraph import SyncedGraph |
1373 | 10 from light9 import networking, showconfig |
11 import optparse, sys, logging | |
12 import cyclone.web | |
13 from rdflib import URIRef | |
1830 | 14 from light9.effect.sequencer import Sequencer, Updates |
15 from light9.collector.collector_client import sendToCollector | |
16 | |
1698
f140153c087c
bring back clientsession which doesn't belong in rdfdb
Drew Perttula <drewp@bigasterisk.com>
parents:
1692
diff
changeset
|
17 from light9 import clientsession |
1373 | 18 |
1858 | 19 |
1373 | 20 class App(object): |
1858 | 21 |
1373 | 22 def __init__(self, show, session): |
23 self.show = show | |
24 self.session = session | |
25 | |
26 self.graph = SyncedGraph(networking.rdfdb.url, "effectSequencer") | |
27 self.graph.initiallySynced.addCallback(self.launch) | |
28 | |
29 def launch(self, *args): | |
1391
4a7594476905
hack up KC so it edits effect strengths instead
Drew Perttula <drewp@bigasterisk.com>
parents:
1373
diff
changeset
|
30 self.seq = Sequencer( |
1927 | 31 self.graph, |
32 lambda settings: sendToCollector( | |
33 'effectSequencer', | |
34 self.session, | |
35 settings, | |
1924
91bcc6c76934
sequencer can use zmq, it seems, but KC should not
Drew Perttula <drewp@bigasterisk.com>
parents:
1859
diff
changeset
|
36 # 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
|
37 # 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
|
38 # 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
|
39 useZmq=True)) |
1373 | 40 |
41 self.cycloneApp = cyclone.web.Application(handlers=[ | |
1858 | 42 (r'/()', cyclone.web.StaticFileHandler, { |
43 "path": "light9/effect/", | |
44 "default_filename": "sequencer.html" | |
45 }), | |
1776 | 46 (r'/updates', Updates), |
2046
9aa046cc9b33
replace greplin with prometheus throughout (untested)
drewp@bigasterisk.com
parents:
2043
diff
changeset
|
47 metricsRoute(), |
1373 | 48 ], |
49 debug=True, | |
1776 | 50 seq=self.seq, |
1373 | 51 graph=self.graph, |
2043
67575505c400
comment out more greplin so services can start
drewp@bigasterisk.com
parents:
1937
diff
changeset
|
52 # stats=self.stats |
67575505c400
comment out more greplin so services can start
drewp@bigasterisk.com
parents:
1937
diff
changeset
|
53 ) |
1373 | 54 reactor.listenTCP(networking.effectSequencer.port, self.cycloneApp) |
55 log.info("listening on %s" % networking.effectSequencer.port) | |
56 | |
57 | |
58 if __name__ == "__main__": | |
59 parser = optparse.OptionParser() | |
1858 | 60 parser.add_option( |
61 '--show', | |
1373 | 62 help='show URI, like http://light9.bigasterisk.com/show/dance2008', |
1858 | 63 default=showconfig.showUri()) |
64 parser.add_option("-v", | |
65 "--verbose", | |
66 action="store_true", | |
1373 | 67 help="logging.DEBUG") |
1858 | 68 parser.add_option("--twistedlog", |
69 action="store_true", | |
1373 | 70 help="twisted logging") |
71 clientsession.add_option(parser) | |
72 (options, args) = parser.parse_args() | |
73 log.setLevel(logging.DEBUG if options.verbose else logging.INFO) | |
74 | |
75 if not options.show: | |
76 raise ValueError("missing --show http://...") | |
1858 | 77 |
1373 | 78 session = clientsession.getUri('effectSequencer', options) |
79 | |
80 app = App(URIRef(options.show), session) | |
81 if options.twistedlog: | |
82 from twisted.python import log as twlog | |
83 twlog.startLogging(sys.stderr) | |
84 reactor.run() |