summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-10-09 09:00:47 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-10-09 09:00:47 +0000
commitf79a2489c1f18f2bf1436fa5ec4c8fd9c903fd61 (patch)
tree97952ac522a9f0376623e5aa868141e5d9b3a821 /lib
parent78590d7d512ada604987fdcc9c31a8c74591f64b (diff)
downloadampache-f79a2489c1f18f2bf1436fa5ec4c8fd9c903fd61.tar.gz
ampache-f79a2489c1f18f2bf1436fa5ec4c8fd9c903fd61.tar.bz2
ampache-f79a2489c1f18f2bf1436fa5ec4c8fd9c903fd61.zip
updates, ajax kind of broken right now its late
Diffstat (limited to 'lib')
-rw-r--r--lib/class/localplay.class.php25
-rw-r--r--lib/ui.lib.php24
2 files changed, 48 insertions, 1 deletions
diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php
index b9f0d8cc..48097882 100644
--- a/lib/class/localplay.class.php
+++ b/lib/class/localplay.class.php
@@ -534,7 +534,7 @@ class Localplay {
* of the current player state
*/
function get_user_state($state) {
-
+
switch ($state) {
case 'play':
return _('Now Playing');
@@ -552,6 +552,29 @@ class Localplay {
} // get_user_state
+ /**
+ * get_user_playing
+ * This attempts to return a nice user friendly
+ * currently playing string
+ */
+ function get_user_playing() {
+
+ $status = $this->status();
+
+ /* Format the track name */
+ $track_name = $status['track_artist'] . ' - ' . $status['track_album'] . ' - ' . $status['track_title'];
+
+ /* This is a cheezball fix for when we were unable to find a
+ * artist/album (or one wasn't provided)
+ */
+ $track_name = ltrim(ltrim($track_name,' - '),' - ');
+
+ $track_name = "[" . $status['track'] . "] - " . $track_name;
+
+ return $track_name;
+
+ } // get_user_playing
+
} //end localplay class
?>
diff --git a/lib/ui.lib.php b/lib/ui.lib.php
index e30db5ec..7b93b37e 100644
--- a/lib/ui.lib.php
+++ b/lib/ui.lib.php
@@ -1334,5 +1334,29 @@ function get_user_icon($name) {
} // show_icon
+/**
+ * xml_from_array
+ * This takes a one dimensional array and
+ * creates a XML document form it for use
+ * primarly by the ajax mojo
+ */
+function xml_from_array($array) {
+
+ $escape_array = array ('<','&');
+ $replace_array = array('&lt;','&amp;');
+
+ $string = "<root>\n";
+ foreach ($array as $key=>$value) {
+ /* We need to escape the value */
+ $value = str_replace($escape_array,$replace_array,$value);
+ $string .= "\t<$key>$value</$key>\n";
+ }
+ $string .= "</root>\n";
+
+ return $string;
+
+} // xml_from_array
+
+
?>