summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorsigger <sigger@ampache>2006-02-02 04:34:15 +0000
committersigger <sigger@ampache>2006-02-02 04:34:15 +0000
commit1e7684528e28aea6f30e31fa3f674d61e282df30 (patch)
treed43678e0104f8a299663779f0c9d23799d885bc3 /lib
parent27847d72ca91c107a1f74cb1e072e58c9cbe7b8f (diff)
downloadampache-1e7684528e28aea6f30e31fa3f674d61e282df30.tar.gz
ampache-1e7684528e28aea6f30e31fa3f674d61e282df30.tar.bz2
ampache-1e7684528e28aea6f30e31fa3f674d61e282df30.zip
mpd mini-control for all pages! final ajax tweak? etc
Diffstat (limited to 'lib')
-rw-r--r--lib/general.js24
-rw-r--r--lib/general.lib.php11
2 files changed, 24 insertions, 11 deletions
diff --git a/lib/general.js b/lib/general.js
index 444029d2..ca86a667 100644
--- a/lib/general.js
+++ b/lib/general.js
@@ -56,12 +56,12 @@ function handleStateChange() {
document.getElementById (new_state+'_button').className = "selected_button";
player_state = new_state;
if (player_state == "stop" || player_state == "pause") {
- document.getElementById ('mpd_np').className = "nodisplay";
-/* turn off the now playing stuff */
+ if (document.getElementById ('mpd_np'))
+ document.getElementById ('mpd_np').className = "nodisplay";
} else
{
- document.getElementById ('mpd_np').className = "";
-/* turn on the now playing stuff */
+ if (document.getElementById ('mpd_np'))
+ document.getElementById ('mpd_np').className = "";
} // end if else
} // end if mpd changed player_state
break;
@@ -69,15 +69,17 @@ function handleStateChange() {
ret_songid = Math.round(el.getElementsByTagName ('songid')[0].firstChild.data);
if (player == 'mpd' && player_state != 'stop') {
mpd_song_length = el.getElementsByTagName ('songlength')[0].firstChild.data;
- document.getElementById ('mpd_npinfo').firstChild.data =
- 1+ret_songid + ". " +
- el.getElementsByTagName ('songartist')[0].firstChild.data + " - " +
- el.getElementsByTagName ('songtitle')[0].firstChild.data + " - " +
- el.getElementsByTagName ('songalbum')[0].firstChild.data + " - " +
- fmt_time(mpd_song_length);
+ if (document.getElementById ('mpd_npinfo')) {
+ document.getElementById ('mpd_npinfo').firstChild.data =
+ 1+ret_songid + ". " +
+ el.getElementsByTagName ('songartist')[0].firstChild.data + " - " +
+ el.getElementsByTagName ('songtitle')[0].firstChild.data + " - " +
+ el.getElementsByTagName ('songalbum')[0].firstChild.data + " - " +
+ fmt_time(mpd_song_length);
+ }
}
if (ret_songid != mpd_songid) {
- if (document.getElementById ('mpd_row'+mpd_songid) != null) {
+ if (document.getElementById ('mpd_row'+mpd_songid)) {
if ((mpd_songid - mpdpl_first) %2 == 1) {
document.getElementById ('mpd_row'+mpd_songid).className = 'even';
} else {
diff --git a/lib/general.lib.php b/lib/general.lib.php
index 9f985196..e485337f 100644
--- a/lib/general.lib.php
+++ b/lib/general.lib.php
@@ -901,4 +901,15 @@ function logout() {
} // logout
+/**
+ * format_time
+ * This formats seconds into minutes:seconds
+ */
+
+function format_time($seconds) {
+
+return sprintf ("%d:%02d", $seconds/60, $seconds % 60);
+
+} //format_time
+
?>