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() - - - + + + - - + +
diff --git a/html/index.html b/html/index.html index f2434f13..2ad804f1 100644 --- a/html/index.html +++ b/html/index.html @@ -6,6 +6,7 @@ + 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("
Library Browser
Remote Controls
") +def controls_page(write): + write_file(write, "html/controls.html") + +def play_button(write): + write_file(write, "html/images/play.png") + +def pause_button(write): + write_file(write, "html/images/pause.png") + +def stop_button(write): + write_file(write, "html/images/stop.png") + +def next_button(write): + write_file(write, "html/images/next.png") + +def rewind_button(write): + write_file(write, "html/images/rewind.png") + +def forward_button(write): + write_file(write, "html/images/forward.png") + def controls(write): write_file(write, "html/controls.js") @@ -39,6 +60,13 @@ def utils(write): docs = { "index.html":(index, "html"), "library.html":(library, "html"), + "controls.html":(controls_page, "html"), "controls.js":(controls, "js"), "utils.js":(utils, "js"), + "play.png":(play_button, "png"), + "pause.png":(pause_button, "png"), + "stop.png":(stop_button, "png"), + "next.png":(next_button, "png"), + "forward.png":(rewind_button, "png"), + "rewind.png":(forward_button, "png"), } diff --git a/libsaria/server/pages/rpc.py b/libsaria/server/pages/rpc.py index 3ce557f6..be7a5941 100644 --- a/libsaria/server/pages/rpc.py +++ b/libsaria/server/pages/rpc.py @@ -9,12 +9,44 @@ def play(write): def pause(write): controls.pause() +def next(write): + controls.next() + +def stop(write): + controls.stop() + +def forward(write): + controls.seek_forward() + +def rewind(write): + controls.seek_backward() + def play_id(write, id): sources.play_id(long(id[0])) +def title(write): + write(sources.get_attrs("title")[0]) + +def artist(write): + write(sources.get_attrs("artist")[0]) + +def album(write): + write(sources.get_attrs("album")[0]) + +def playing(write): + write(controls.playing()) + rpc = { - "play.html":(play, "html"), - "pause.html":(pause, "html"), + "play":(play, "html"), + "pause":(pause, "html"), + "stop":(stop, "html"), + "next":(next, "html"), + "forward":(forward, "html"), + "rewind":(rewind, "html"), + "title":(title, "html"), + "artist":(artist, "html"), + "album":(album, "html"), + "playing":(playing, "html"), "play_id":(play_id, "html"), }