diff --git a/light9/ascoltami/index.html b/light9/ascoltami/index.html --- a/light9/ascoltami/index.html +++ b/light9/ascoltami/index.html @@ -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 --git a/light9/ascoltami/webapp.py b/light9/ascoltami/webapp.py --- a/light9/ascoltami/webapp.py +++ b/light9/ascoltami/webapp.py @@ -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 @@ class root(PrettyErrorHandler, cyclone.w 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):