# HG changeset patch # User Drew Perttula # Date 1559457787 0 # Node ID 1cb63991eb19fe5efda5e896b05cded8b99c9a32 # Parent 4718ca6f812e5a2150ed3b0ada46f77eb31efc6c asco use cyclone templating instead of genshi Ignore-this: 1f66e01d6e3a11c5abad8f594027f514 diff -r 4718ca6f812e -r 1cb63991eb19 light9/ascoltami/index.html --- a/light9/ascoltami/index.html Sun Jun 02 00:07:42 2019 +0000 +++ b/light9/ascoltami/index.html Sun Jun 02 06:43:07 2019 +0000 @@ -4,7 +4,7 @@ - ascoltami on ${host} + ascoltami on {{host}} @@ -15,7 +15,7 @@ -

ascoltami on ${host}

+

ascoltami on {{host}}

@@ -68,10 +68,7 @@ } $("#updateReq").text(updateFreq); - var times = { // need to get these from server - intro: 4, - post: 4 - }; + var times = {% raw times %}; var currentDuration = 0; var currentHighlightedSong = ""; diff -r 4718ca6f812e -r 1cb63991eb19 light9/ascoltami/webapp.py --- a/light9/ascoltami/webapp.py Sun Jun 02 00:07:42 2019 +0000 +++ b/light9/ascoltami/webapp.py Sun Jun 02 06:43:07 2019 +0000 @@ -1,15 +1,17 @@ -import json, socket, subprocess, cyclone.web -from twisted.python.util import sibpath +import json, socket, subprocess, os + +from cyclone import template +from rdflib import URIRef +import cyclone.web + +from cycloneerr import PrettyErrorHandler from light9.namespaces import L9 from light9.showconfig import getSongsFromShow, songOnDisk -from rdflib import URIRef -from web.contrib.template import render_genshi -render = render_genshi([sibpath(__file__, ".")], auto_reload=True) - -from cycloneerr import PrettyErrorHandler _songUris = {} # locationUri : song +loader = template.Loader(os.path.dirname(__file__)) + def songLocation(graph, songUri): loc = URIRef("file://%s" % songOnDisk(songUri)) @@ -25,9 +27,12 @@ def get(self): self.set_header("Content-Type", "application/xhtml+xml") - # todo: use a template; embed the show name and the intro/post - # times into the page - self.write(render.index(host=socket.gethostname())) + self.write( + loader.load('index.html').generate(host=socket.gethostname(), + times=json.dumps({ + 'intro': 4, + 'post': 4 + }))) def playerSongUri(graph, player):