diff options
-rwxr-xr-x | docs/CHANGELOG | 3 | ||||
-rw-r--r-- | lib/class/localplay.class.php | 69 | ||||
-rw-r--r-- | modules/init.php | 2 | ||||
-rw-r--r-- | modules/localplay/mpd.controller.php | 2 | ||||
-rw-r--r-- | templates/show_playlist_edit.inc.php | 3 |
5 files changed, 75 insertions, 4 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG index b91e4580..4e1789d6 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,9 @@ -------------------------------------------------------------------------- v.3.3.2-Beta3 + - Fixed a missing web_path reference on playlist edit page + - Added Localplay API, check the wiki for more information + https://ampache.bountysource.com/wiki/Localplay - Added Download to Random play along with Size limitation usefull for downloading a set amount of music for your mp3 player. diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php index dc59f6af..69b48cdf 100644 --- a/lib/class/localplay.class.php +++ b/lib/class/localplay.class.php @@ -47,6 +47,9 @@ class Localplay { $this->_get_info(); + /* Test for a connection */ + $this->connect(); + } // Localplay @@ -82,8 +85,10 @@ class Localplay { } // include else { - $class_name = $this->type; + $class_name = "Ampache" . $this->type; $this->_player = new $class_name(); + $function_map = $this->_player->function_map(); + $this->_map_functions($function_map); } } // _load_player @@ -95,8 +100,12 @@ class Localplay { */ function has_function($function_name) { + /* Check the function map, if it's got a value it must + * be possible + */ + if (strlen($this->_function_map) > 0) { return true; } - + return false; } // has_function @@ -117,6 +126,7 @@ class Localplay { $this->_function_map['delete'] = $data['delete']; $this->_function_map['play'] = $data['play']; $this->_function_map['stop'] = $data['stop']; + $this->_function_map['connect'] = $data['connect']; /* Recommended Functions */ $this->_function_map['next'] = $data['next']; @@ -132,6 +142,61 @@ class Localplay { } // _map_functions /** + * connect + * This function attempts to connect to the localplay + * player that we are using + */ + function connect() { + + + $function = $this->_function_map['connect']; + + if (!$this->_player->$function()) { + debug_event('localplay','Error Unable to connect, check ' . $this->type . ' controller','1'); + return false; + } + + return true; + + } // connect + + /** + * play + * This function passes NULL and calls the play function of the player + * object + */ + function play() { + + $function = $this->_function_map['play']; + + if (!$this->_player->$function()) { + debug_event('localplay','Error Unable to start playback, check ' . $this->type . ' controller','1'); + return false; + } + + return true; + + } // play + + /** + * stop + * This functions passes NULl and calls the stop function of the player + * object, it should recieve a true/false boolean value + */ + function stop() { + + $function = $this->_function_map['stop']; + + if (!$this->_player->$function()) { + debug_event('localplay','Error Unable to stop playback, check ' . $this->type . ' controller','1'); + return false; + } + + return true; + + } // stop + + /** * add * This function takes an array of song_ids and then passes the full URL * to the player, this is a required function. diff --git a/modules/init.php b/modules/init.php index bf4f9445..5e8257b4 100644 --- a/modules/init.php +++ b/modules/init.php @@ -80,7 +80,7 @@ if (!$results['allow_stream_playback']) { /** This is the version.... fluf nothing more... **/ -$results['version'] = '3.3.2-Beta3 (Build 001)'; +$results['version'] = '3.3.2-Beta3 (Build 002)'; diff --git a/modules/localplay/mpd.controller.php b/modules/localplay/mpd.controller.php index f6ec4fac..160e3e6e 100644 --- a/modules/localplay/mpd.controller.php +++ b/modules/localplay/mpd.controller.php @@ -211,7 +211,7 @@ class AmpacheMpd { */ function connect() { - $this->_mpd = new mpd(conf('localplay_mpd_hostnmae'),conf('localplay_mpd_port')); + $this->_mpd = new mpd(conf('localplay_mpd_hostname'),conf('localplay_mpd_port')); if ($this->_mpd->connected) { return true; } diff --git a/templates/show_playlist_edit.inc.php b/templates/show_playlist_edit.inc.php index afb12056..48bd78fa 100644 --- a/templates/show_playlist_edit.inc.php +++ b/templates/show_playlist_edit.inc.php @@ -19,6 +19,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +$web_path = conf('web_path'); + ?> <form method="post" action="<?php echo $web_path; ?>/playlist.php" enctype="multipart/form-data"> <table class="text-box"> |