changeset 625:ad41fdc33a91

asco displays hostname and sends better content-type headers Ignore-this: a25ba775fa44991c2166740410297eae
author drewp@bigasterisk.com
date Wed, 15 Jun 2011 05:32:23 +0000
parents 9071cd1bb29c
children 1a2fc3a93b3e
files light9/ascoltami/index.html light9/ascoltami/webapp.py show/dance2010/readme
diffstat 3 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/light9/ascoltami/index.html	Wed Jun 15 05:31:33 2011 +0000
+++ b/light9/ascoltami/index.html	Wed Jun 15 05:32:23 2011 +0000
@@ -1,16 +1,17 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
+<html xmlns="http://www.w3.org/1999/xhtml" 
+      xmlns:py="http://genshi.edgewall.org/">
   <head>
-    <title>ascoltami</title>
+    <title>ascoltami on ${host}</title>
     <script type="text/javascript" src="static/jquery-1.4.2.min.js"></script>
       <script type="text/javascript" src="static/jquery-ui-1.8.2.custom/js/jquery-ui-1.8.2.custom.min.js"></script>
       <link rel="Stylesheet" type="text/css" href="static/jquery-ui-1.8.2.custom/css/smoothness/jquery-ui-1.8.2.custom.css"/>
       <link rel="Stylesheet" type="text/css" href="static/style.css"/>
   </head>
   <body>
-
+    <h1>ascoltami on ${host}</h1>
     <div class="songs"/>
 
     <div>Song: <span id="currentSong"/></div>
--- a/light9/ascoltami/webapp.py	Wed Jun 15 05:31:33 2011 +0000
+++ b/light9/ascoltami/webapp.py	Wed Jun 15 05:32:23 2011 +0000
@@ -1,9 +1,10 @@
-import web, jsonlib
+import web, jsonlib, socket
 from twisted.python.util import sibpath
 from light9.namespaces import L9
 from light9.showconfig import getSongsFromShow
 from rdflib import URIRef
-
+from web.contrib.template import render_genshi
+render = render_genshi([sibpath(__file__, ".")])
 app = None
 
 def songLocation(graph, songUri):
@@ -23,7 +24,7 @@
         web.header("Content-type", "application/xhtml+xml")
         # todo: use a template; embed the show name and the intro/post
         # times into the page
-        return open(sibpath(__file__, "index.html")).read()
+        return render.index(host=socket.gethostname())
 
 class timeResource(object):
     def GET(self):
@@ -35,6 +36,7 @@
             song = songUri(graph, URIRef(playingLocation))
         else:
             song = None
+        web.header("content-type", "application/json")
         return jsonlib.write({
             "song" : song,
             "started" : player.playStartTime,
@@ -56,6 +58,7 @@
             player.resume()
         if 't' in params:
             player.seek(params['t'])
+        web.header("content-type", "text/plain")
         return "ok"
 
 class songs(object):
@@ -76,6 +79,7 @@
         graph = app.graph
 
         app.player.setSong(songLocation(graph, URIRef(web.data())))
+        web.header("content-type", "text/plain")
         return "ok"
     
 class seekPlayOrPause(object):
--- a/show/dance2010/readme	Wed Jun 15 05:31:33 2011 +0000
+++ b/show/dance2010/readme	Wed Jun 15 05:32:23 2011 +0000
@@ -48,7 +48,7 @@
 - factor out music dir so it can be different per machine
 - all settings should be in RDF and live-shared across all apps, maybe with anzo for updates
 - when curvecalc says 'Slider 1', the X coordinates of the curve get misaligned
-- asco should say clearly what machine it's running on
+OK asco should say clearly what machine it's running on
 - asco should have GUI for picking which sound output you want, and store the setting
 - vidref should have snapshot button for taking pics of the stage
 - bring mini tripod or beanbag for the vidref camera