diff --git a/light9/ascoltami/webapp.py b/light9/ascoltami/webapp.py --- a/light9/ascoltami/webapp.py +++ b/light9/ascoltami/webapp.py @@ -28,17 +28,15 @@ class root(PrettyErrorHandler, cyclone.w def get(self): self.set_header("Content-Type", "text/html") - self.write( - loader.load('index.html').generate()) + self.write(loader.load('index.html').generate()) + class config(cyclone.web.RequestHandler): + def get(self): self.set_header("Content-Type", "application/json") - self.write(json.dumps(dict(host=socket.gethostname(), - times={ - 'intro': 4, - 'post': 4 - }))) + self.write(json.dumps(dict(host=socket.gethostname(), times={'intro': 4, 'post': 4}))) + def playerSongUri(graph, player): """or None""" @@ -125,14 +123,7 @@ class songs(PrettyErrorHandler, cyclone. songs = getSongsFromShow(graph, self.settings.app.show) self.set_header("Content-Type", "application/json") - self.write( - json.dumps({ - "songs": [{ - "uri": s, - "path": graph.value(s, L9['showPath']), - "label": graph.label(s) - } for s in songs] - })) + self.write(json.dumps({"songs": [{"uri": s, "path": graph.value(s, L9['showPath']), "label": graph.label(s)} for s in songs]})) class songResource(PrettyErrorHandler, cyclone.web.RequestHandler): @@ -141,8 +132,7 @@ class songResource(PrettyErrorHandler, c """post a uri of song to switch to (and start playing)""" graph = self.settings.app.graph - self.settings.app.player.setSong( - songLocation(graph, URIRef(self.request.body.decode('utf8')))) + self.settings.app.player.setSong(songLocation(graph, URIRef(self.request.body.decode('utf8')))) self.set_header("Content-Type", "text/plain") self.write("ok")