From 798134b910b636922f7acb0ac3573dc381e76a40 Mon Sep 17 00:00:00 2001
From: Bryan Schumaker
Date: Thu, 22 Dec 2011 14:16:33 -0500
Subject: [PATCH] Web server improvements
I want to use the remote control this weekend, so I needed to fix it up.
---
html/controls.html | 16 +++++++-------
html/index.html | 1 +
html/utils.js | 4 ++--
libsaria/server/pages/__init__.py | 1 +
libsaria/server/pages/root.py | 28 ++++++++++++++++++++++++
libsaria/server/pages/rpc.py | 36 +++++++++++++++++++++++++++++--
6 files changed, 74 insertions(+), 12 deletions(-)
diff --git a/html/controls.html b/html/controls.html
index 37c26612..89d839d0 100644
--- a/html/controls.html
+++ b/html/controls.html
@@ -6,14 +6,14 @@
function set_playing()
{
var button = document.getElementById("button");
- button.src = "images/pause.png";
+ button.src = "pause.png";
button.onclick = pause2;
}
function set_paused()
{
var button = document.getElementById("button");
- button.src = "images/play.png";
+ button.src = "play.png";
button.onclick = play2;
}
@@ -33,7 +33,7 @@ function set_play_button()
}
}
}
- req.open('GET', "controls.py?a=playing", true);
+ req.open('GET', "RPC/playing", true);
req.send();
}
@@ -72,12 +72,12 @@ function stop2()
|
Library Browser |
+ Remote Controls |
diff --git a/html/utils.js b/html/utils.js
index 3fc1bcc7..4c978e8d 100644
--- a/html/utils.js
+++ b/html/utils.js
@@ -11,7 +11,7 @@ function set_attr(attr, id)
}
}
- req.open('GET', "controls.py?a=" + attr, true);
+ req.open('GET', "RPC/" + attr, true);
req.send();
setTimeout("set_attr(\"" + attr + "\", \"" + id + "\")", 3000)
}
@@ -26,7 +26,7 @@ function set_attr_once(attr, id)
document.getElementById(id).innerHTML = req.responseText;
}
}
- req.open('GET', "controls.py?a=" + attr, true);
+ req.open('GET', "RPC/" + attr, true);
req.send();
}
diff --git a/libsaria/server/pages/__init__.py b/libsaria/server/pages/__init__.py
index 801639b3..b8c06e6c 100644
--- a/libsaria/server/pages/__init__.py
+++ b/libsaria/server/pages/__init__.py
@@ -10,6 +10,7 @@ docs.update(rpc.docs)
types = {
"html":"text/html",
"js":"text/javascript",
+ "png":"image/png",
}
def lookup(file):
diff --git a/libsaria/server/pages/root.py b/libsaria/server/pages/root.py
index 5870a242..9f4552e8 100644
--- a/libsaria/server/pages/root.py
+++ b/libsaria/server/pages/root.py
@@ -30,6 +30,27 @@ def library(write):
color = "white"
write("