Mercurial > code > home > repos > light9
comparison bin/curvecalc @ 763:ffecebbdcc95
curvecalc serves the time you're hovering over
Ignore-this: 1175a24abc1de8f6e995e925bb25caab
author | drewp@bigasterisk.com |
---|---|
date | Sat, 16 Jun 2012 02:53:49 +0000 |
parents | 857aab04f7bd |
children | c0977217a7da |
comparison
equal
deleted
inserted
replaced
762:9e373ba54aa9 | 763:ffecebbdcc95 |
---|---|
13 | 13 |
14 from twisted.internet import gtk2reactor | 14 from twisted.internet import gtk2reactor |
15 gtk2reactor.install() | 15 gtk2reactor.install() |
16 from twisted.internet import reactor | 16 from twisted.internet import reactor |
17 | 17 |
18 import time, textwrap, os, optparse, gtk, linecache, signal, traceback | 18 import time, textwrap, os, optparse, gtk, linecache, signal, traceback, json |
19 import louie as dispatcher | 19 import louie as dispatcher |
20 from rdflib import URIRef, Graph, Literal, RDF, RDFS | 20 from rdflib import URIRef, Graph, Literal, RDF, RDFS |
21 import logging | 21 import logging |
22 log = logging.getLogger() | 22 log = logging.getLogger() |
23 | 23 |
24 import run_local | 24 import run_local |
25 from light9 import showconfig, prof | 25 from light9 import showconfig, prof, networking |
26 from light9.curvecalc.curve import Curveset | 26 from light9.curvecalc.curve import Curveset |
27 from light9.curvecalc import curveview | 27 from light9.curvecalc import curveview |
28 from light9.curvecalc.musicaccess import Music, currentlyPlayingSong | 28 from light9.curvecalc.musicaccess import Music, currentlyPlayingSong |
29 from light9.wavelength import wavelength | 29 from light9.wavelength import wavelength |
30 from light9.namespaces import L9 | 30 from light9.namespaces import L9 |
330 | 330 |
331 if opts.startup_only: | 331 if opts.startup_only: |
332 log.debug("quitting now because of --startup-only") | 332 log.debug("quitting now because of --startup-only") |
333 return | 333 return |
334 | 334 |
335 from twisted.web import server, resource | |
336 class Hover(resource.Resource): | |
337 isLeaf = True | |
338 def render_GET(self, request): | |
339 if request.path == '/hoverTime': | |
340 results = dispatcher.send("onPlayPause") | |
341 times = [t for listener, t in results if t is not None] | |
342 if not times: | |
343 request.setResponseCode(404) | |
344 return "not hovering over any time" | |
345 | |
346 return json.dumps({"song":song, "hoverTime" : times[0]}) | |
347 raise NotImplementedError() | |
348 | |
349 reactor.listenTCP(networking.curveCalc.port, | |
350 server.Site(Hover())) | |
351 | |
352 | |
335 prof.run(reactor.run, profile=False) | 353 prof.run(reactor.run, profile=False) |
336 | 354 |
337 main() | 355 main() |