Mercurial > code > home > repos > light9
annotate bin/effectsequencer @ 1776:b680d6f50a93
start sequencer web report. WIP
Ignore-this: e97eadee6190d2c90cfb81f3542f4f2f
author | drewp@bigasterisk.com |
---|---|
date | Sun, 03 Jun 2018 21:04:00 +0000 |
parents | f140153c087c |
children | 8e0e5b3db301 |
rev | line source |
---|---|
1373 | 1 #!bin/python |
2 """ | |
3 plays back effect notes from the timeline | |
4 """ | |
5 from __future__ import division | |
6 from run_local import log | |
7 from twisted.internet import reactor | |
8 from light9.greplin_cyclone import StatsForCyclone | |
1692 | 9 from rdfdb.syncedgraph import SyncedGraph |
1373 | 10 from light9 import networking, showconfig |
11 from greplin import scales | |
12 import optparse, sys, logging | |
13 import cyclone.web | |
14 from rdflib import URIRef | |
1776 | 15 from light9.effect.sequencer import Sequencer, sendToCollector, Updates |
1698
f140153c087c
bring back clientsession which doesn't belong in rdfdb
Drew Perttula <drewp@bigasterisk.com>
parents:
1692
diff
changeset
|
16 from light9 import clientsession |
1373 | 17 |
18 class App(object): | |
19 def __init__(self, show, session): | |
20 self.show = show | |
21 self.session = session | |
22 | |
23 self.graph = SyncedGraph(networking.rdfdb.url, "effectSequencer") | |
24 self.graph.initiallySynced.addCallback(self.launch) | |
25 | |
26 | |
27 self.stats = scales.collection('/', | |
28 scales.PmfStat('sendLevels'), | |
29 scales.PmfStat('getMusic'), | |
30 scales.PmfStat('evals'), | |
31 scales.PmfStat('sendOutput'), | |
32 scales.IntStat('errors'), | |
33 ) | |
34 def launch(self, *args): | |
1391
4a7594476905
hack up KC so it edits effect strengths instead
Drew Perttula <drewp@bigasterisk.com>
parents:
1373
diff
changeset
|
35 self.seq = Sequencer( |
4a7594476905
hack up KC so it edits effect strengths instead
Drew Perttula <drewp@bigasterisk.com>
parents:
1373
diff
changeset
|
36 self.graph, |
4a7594476905
hack up KC so it edits effect strengths instead
Drew Perttula <drewp@bigasterisk.com>
parents:
1373
diff
changeset
|
37 lambda settings: sendToCollector('effectSequencer', self.session, |
4a7594476905
hack up KC so it edits effect strengths instead
Drew Perttula <drewp@bigasterisk.com>
parents:
1373
diff
changeset
|
38 settings)) |
1373 | 39 |
40 self.cycloneApp = cyclone.web.Application(handlers=[ | |
1776 | 41 (r'/()', cyclone.web.StaticFileHandler, |
42 {"path" : "light9/effect/", "default_filename" : "sequencer.html"}), | |
43 (r'/updates', Updates), | |
1373 | 44 (r'/stats', StatsForCyclone), |
45 ], | |
46 debug=True, | |
1776 | 47 seq=self.seq, |
1373 | 48 graph=self.graph, |
49 stats=self.stats) | |
50 reactor.listenTCP(networking.effectSequencer.port, self.cycloneApp) | |
51 log.info("listening on %s" % networking.effectSequencer.port) | |
52 | |
53 | |
54 if __name__ == "__main__": | |
55 parser = optparse.OptionParser() | |
56 parser.add_option('--show', | |
57 help='show URI, like http://light9.bigasterisk.com/show/dance2008', | |
58 default=showconfig.showUri()) | |
59 parser.add_option("-v", "--verbose", action="store_true", | |
60 help="logging.DEBUG") | |
61 parser.add_option("--twistedlog", action="store_true", | |
62 help="twisted logging") | |
63 clientsession.add_option(parser) | |
64 (options, args) = parser.parse_args() | |
65 log.setLevel(logging.DEBUG if options.verbose else logging.INFO) | |
66 | |
67 if not options.show: | |
68 raise ValueError("missing --show http://...") | |
69 | |
70 session = clientsession.getUri('effectSequencer', options) | |
71 | |
72 app = App(URIRef(options.show), session) | |
73 if options.twistedlog: | |
74 from twisted.python import log as twlog | |
75 twlog.startLogging(sys.stderr) | |
76 reactor.run() |