Mercurial > code > home > repos > light9
changeset 2054:960a22eed99c
reformat
author | drewp@bigasterisk.com |
---|---|
date | Fri, 13 May 2022 01:10:35 -0700 |
parents | b7a3dff5514d |
children | 175a1cf36796 |
files | light9/ascoltami/webapp.py |
diffstat | 1 files changed, 7 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/ascoltami/webapp.py Fri May 13 01:09:14 2022 -0700 +++ b/light9/ascoltami/webapp.py Fri May 13 01:10:35 2022 -0700 @@ -28,17 +28,15 @@ 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 @@ 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 @@ """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")