2010-11-19 22:47:41 -05:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<script type="text/javascript">
|
2010-12-24 12:31:55 -05:00
|
|
|
function set_attr(attr)
|
|
|
|
{
|
|
|
|
var req = new XMLHttpRequest();
|
|
|
|
req.onreadystatechange=function()
|
|
|
|
{
|
|
|
|
if (req.readyState == 4 && req.status == 200)
|
|
|
|
{
|
|
|
|
document.getElementById(attr).innerHTML = req.responseText;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
req.open('GET', "controls.py?a=" + attr, true)
|
|
|
|
req.send()
|
2010-12-24 12:41:26 -05:00
|
|
|
setTimeout("set_attr(\"" + attr + "\")", 3000)
|
2010-12-24 12:31:55 -05:00
|
|
|
}
|
|
|
|
|
2010-11-19 22:47:41 -05:00
|
|
|
function do_request(action)
|
|
|
|
{
|
|
|
|
var http = new XMLHttpRequest();
|
|
|
|
http.open('GET', "controls.py?a="+action, true);
|
|
|
|
http.send();
|
|
|
|
return http;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*function get_response(http)
|
|
|
|
{
|
|
|
|
while (http.readyState != 4)
|
|
|
|
{}
|
|
|
|
|
|
|
|
var resp = http.responseText;
|
|
|
|
return resp;
|
|
|
|
}*/
|
|
|
|
|
|
|
|
function control(action)
|
|
|
|
{
|
|
|
|
var http = do_request(action);
|
|
|
|
/*var resp = get_response(http);*/
|
|
|
|
}
|
|
|
|
|
|
|
|
function play()
|
|
|
|
{
|
|
|
|
control("play");
|
|
|
|
var button = document.getElementById("play_pause");
|
2010-12-26 12:27:52 -05:00
|
|
|
button.innerHTML = "<img src=\"images/pause.png\" onclick=\"pause();\">";
|
2010-11-19 22:47:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
function pause()
|
|
|
|
{
|
|
|
|
control("pause");
|
|
|
|
var button = document.getElementById("play_pause");
|
2010-12-26 12:27:52 -05:00
|
|
|
button.innerHTML = "<img src=\"images/play.png\" onclick=\"play();\">";
|
2010-11-19 22:47:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
function stop()
|
|
|
|
{
|
|
|
|
control("stop");
|
|
|
|
var button = document.getElementById("play_pause");
|
2010-12-26 12:27:52 -05:00
|
|
|
button.innerHTML = "<img src=\"images/play.png\" onclick=\"play();\">";
|
2010-11-19 22:47:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
function next()
|
|
|
|
{
|
|
|
|
control("next");
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
2010-12-24 12:31:55 -05:00
|
|
|
<table>
|
|
|
|
<tr><td id="title">Title goes here...</td></tr>
|
|
|
|
<tr><td id="artist">Artist goes here...</td></tr>
|
|
|
|
<tr><td id="album">Album goes here...</td></tr>
|
|
|
|
</table>
|
2010-11-19 22:47:41 -05:00
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<td id="play_pause">
|
2010-12-26 12:27:52 -05:00
|
|
|
<img src="images/play.png" onclick="play();"/>
|
2010-11-19 22:47:41 -05:00
|
|
|
</td><td>
|
2010-12-26 12:27:52 -05:00
|
|
|
<img src="images/stop.png" onclick="stop();"/>
|
2010-11-19 22:47:41 -05:00
|
|
|
</td><td>
|
2010-12-26 12:27:52 -05:00
|
|
|
<img src="images/next.png" onclick="next();"/>
|
2010-11-19 22:47:41 -05:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
2010-12-24 12:31:55 -05:00
|
|
|
<script type="text/javascript">
|
|
|
|
set_attr("title");
|
|
|
|
set_attr("artist");
|
|
|
|
set_attr("album");
|
|
|
|
</script>
|
|
|
|
|
2010-11-19 22:47:41 -05:00
|
|
|
</html>
|