Mercurial > code > home > repos > light9
changeset 887:4fe5612db2ed
curvecalc don't start doing graph work until our first sync
Ignore-this: a4cf7b3493bdc945c14742542b5c1a17
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Sat, 08 Jun 2013 08:20:48 +0000 |
parents | 30e2ded920cd |
children | cad8207933d7 |
files | bin/curvecalc |
diffstat | 1 files changed, 31 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/curvecalc Sat Jun 08 08:20:03 2013 +0000 +++ b/bin/curvecalc Sat Jun 08 08:20:48 2013 +0000 @@ -322,33 +322,7 @@ def get(self): return self.maxtime -def main(): - startTime = time.time() - parser = optparse.OptionParser() - parser.set_usage("%prog [opts] [songURI]") - parser.add_option("--sliders", action='store_true', - help='use hardware sliders') - parser.add_option("--skip-music", action='store_true', - help="ignore music and smooth_music curve files") - parser.add_option("--debug", action="store_true", - help="log at DEBUG") - parser.add_option("--reload", action="store_true", - help="live reload of themes and code") - parser.add_option("--startup-only", action='store_true', - help="quit after loading everything (for timing tests)") - clientsession.add_option(parser) - opts, args = parser.parse_args() - - logging.basicConfig(format="%(asctime)s %(levelname)-5s %(name)s %(filename)s:%(lineno)d: %(message)s") - log.setLevel(logging.DEBUG if opts.debug else logging.INFO) - - log.debug("startup: music %s", time.time() - startTime) - - - session = clientsession.getUri('curvecalc', opts) - - music = Music() - graph = SyncedGraph("curvecalc") +def launch(args, graph, session, opts, startTime, music): try: song = URIRef(args[0]) @@ -405,7 +379,37 @@ reactor.listenTCP(networking.curveCalc.port, server.Site(Hover())) +def main(): + startTime = time.time() + parser = optparse.OptionParser() + parser.set_usage("%prog [opts] [songURI]") + parser.add_option("--sliders", action='store_true', + help='use hardware sliders') + parser.add_option("--skip-music", action='store_true', + help="ignore music and smooth_music curve files") + parser.add_option("--debug", action="store_true", + help="log at DEBUG") + parser.add_option("--reload", action="store_true", + help="live reload of themes and code") + parser.add_option("--startup-only", action='store_true', + help="quit after loading everything (for timing tests)") + clientsession.add_option(parser) + opts, args = parser.parse_args() + logging.basicConfig(format="%(asctime)s %(levelname)-5s %(name)s %(filename)s:%(lineno)d: %(message)s") + log.setLevel(logging.DEBUG if opts.debug else logging.INFO) + + log.debug("startup: music %s", time.time() - startTime) + + + session = clientsession.getUri('curvecalc', opts) + + music = Music() + graph = SyncedGraph("curvecalc") + + graph.initiallySynced.addCallback( + lambda _: launch(args, graph, session, opts, startTime, music)) + prof.run(reactor.run, profile=False) prof.run(main, profile=False)