diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-06-06 01:24:39 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-06-06 01:24:39 +0000 |
commit | 56acdc4b64567461ca153f617e3ec86938369516 (patch) | |
tree | 1208cd4e33c2bfa2e228fe19f27248c856dd14a3 /lib/class/localplay.class.php | |
parent | bc0d3d581e4bf62e1afda4455612ab25951e0b5f (diff) | |
download | ampache-56acdc4b64567461ca153f617e3ec86938369516.tar.gz ampache-56acdc4b64567461ca153f617e3ec86938369516.tar.bz2 ampache-56acdc4b64567461ca153f617e3ec86938369516.zip |
turn the sajax stuff back into ajax and also commit some broken mpd skipping code yea!
Diffstat (limited to 'lib/class/localplay.class.php')
-rw-r--r-- | lib/class/localplay.class.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php index a3492ff3..11510f30 100644 --- a/lib/class/localplay.class.php +++ b/lib/class/localplay.class.php @@ -105,6 +105,25 @@ class Localplay { } // has_function + /** + * format_name + * This function takes the track name and checks to see if 'skip' + * is supported in the current player, if so it returns a 'skip to' + * link, otherwise it returns just the text + */ + function format_name($name,$id) { + + $name = scrub_out($name); + + if ($this->has_function('skip')) { + $url = conf('web_path') . '/server/ajax.server.php?action=localplay&cmd=skip&value=' . $id; + + $name = "<span style=\"cursor:pointer;text-decoration:underline;\" onclick=\"ajaxRequest('$url');\">$name</span>"; + } + + return $name; + + } // format_name /** * _map_functions @@ -130,6 +149,7 @@ class Localplay { $this->_function_map['pause'] = $data['pause']; $this->_function_map['next'] = $data['next']; $this->_function_map['prev'] = $data['prev']; + $this->_function_map['skip'] = $data['skip']; $this->_function_map['get_playlist'] = $data['get_playlist']; $this->_function_map['get_playing'] = $data['get_playing']; @@ -261,6 +281,23 @@ class Localplay { } // get /** + * skip + * This isn't a required function, it tells the daemon to skip to the specified song + */ + function skip($song_id) { + + $function = $this->_function_map['skip']; + + if (!$this->_player->$function($song_id)) { + debug_event('localplay','Error: Unable to skip to next song, check ' . $this->type . ' controller','1'); + return false; + } + + return true; + + } // skip + + /** * next * This isn't a required function, it tells the daemon to go to the next * song |