From 56acdc4b64567461ca153f617e3ec86938369516 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Tue, 6 Jun 2006 01:24:39 +0000 Subject: turn the sajax stuff back into ajax and also commit some broken mpd skipping code yea! --- lib/class/localplay.class.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'lib') 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 = "$name"; + } + + 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']; @@ -260,6 +280,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 -- cgit