Changeset - 1cb63991eb19
[Not reviewed]
default
0 2 0
Drew Perttula - 6 years ago 2019-06-02 06:43:07
drewp@bigasterisk.com
asco use cyclone templating instead of genshi
Ignore-this: 1f66e01d6e3a11c5abad8f594027f514
2 files changed with 18 insertions and 16 deletions:
0 comments (0 inline, 0 general)
light9/ascoltami/index.html
Show inline comments
 
<?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" 
 
      xmlns:py="http://genshi.edgewall.org/">
 
  <head>
 
    <title>ascoltami on ${host}</title>
 
    <title>ascoltami on {{host}}</title>
 
    <script type="text/javascript" src="/lib/jquery/dist/jquery.min.js"></script>
 
    <script type="text/javascript" src="/lib/jquery-ui/jquery-ui.min.js"></script>
 
    <link rel="Stylesheet" type="text/css" href="/lib/jquery-ui/themes/smoothness/jquery-ui.min.css"/>
 
    <link rel="Stylesheet" type="text/css" href="/style.css"/>
 
    <style>
 
        #cmd-go { min-width: 5em; }
 
        .song-name { padding-left: 0.4em; }
 
    </style>
 
  </head>
 
  <body>
 
    <h1>ascoltami on ${host}</h1>
 
    <h1>ascoltami on {{host}}</h1>
 
    <div class="songs"/>
 

	
 
    <div class="dimStalled">
 
      <table>
 
        <tr><td colspan="3"><strong>Song:</strong> <span id="currentSong"/></td></tr>
 
        <tr>
 
@@ -65,16 +65,13 @@
 
    if (navigator.userAgent.match(/Windows NT/)) {
 
      // helper laptop
 
      updateFreq = 10;
 
    }
 
    $("#updateReq").text(updateFreq);
 

	
 
    var times = { // need to get these from server
 
	intro: 4,
 
	post: 4
 
    };
 
    var times = {% raw times %};
 

	
 
    var currentDuration = 0;
 
    var currentHighlightedSong = "";
 
    var lastPlaying;
 
    function updateCurrent(doneCallback) {
 
	$.getJSON("time", {}, function (data, status) {
light9/ascoltami/webapp.py
Show inline comments
 
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))
 
    _songUris[loc] = songUri
 
    return loc
 

	
 
@@ -22,15 +24,18 @@ def songUri(graph, locationUri):
 

	
 

	
 
class root(PrettyErrorHandler, cyclone.web.RequestHandler):
 

	
 
    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):
 
    """or None"""
 

	
 
    playingLocation = player.getSong()
0 comments (0 inline, 0 general)