summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/modules.php10
-rw-r--r--lib/class/localplay.class.php16
-rw-r--r--modules/localplay/httpq.controller.php2
-rw-r--r--modules/localplay/mpd.controller.php19
-rw-r--r--templates/show_localplay_controllers.inc.php11
5 files changed, 55 insertions, 3 deletions
diff --git a/admin/modules.php b/admin/modules.php
index 38466139..d5eb3db9 100644
--- a/admin/modules.php
+++ b/admin/modules.php
@@ -55,6 +55,16 @@ switch ($_REQUEST['action']) {
$body = '';
show_confirmation($title,$body,$url);
break;
+ case 'install_localplay':
+
+
+ break;
+ case 'confirm_uninstall_localplay':
+
+ break;
+ case 'uninstall_localplay':
+
+ break;
case 'install_plugin':
/* Verify that this plugin exists */
$plugins = Plugin::get_plugins();
diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php
index d9d19841..d2611609 100644
--- a/lib/class/localplay.class.php
+++ b/lib/class/localplay.class.php
@@ -58,6 +58,22 @@ class Localplay {
} // _get_info
/**
+ * player_loaded
+ * This returns true / false if the player load
+ * failed / worked
+ */
+ public function player_loaded() {
+
+ if (is_object($this->_player)) {
+ return true;
+ }
+ else {
+ return false;
+ }
+
+ } // player_loaded
+
+ /**
* format
* This makes the localplay/plugin information
* human readable
diff --git a/modules/localplay/httpq.controller.php b/modules/localplay/httpq.controller.php
index 3ceb8c04..7e812792 100644
--- a/modules/localplay/httpq.controller.php
+++ b/modules/localplay/httpq.controller.php
@@ -107,7 +107,6 @@ class AmpacheHttpq extends localplay_controller {
*/
public function is_installed() {
-
} // is_installed
/**
@@ -117,7 +116,6 @@ class AmpacheHttpq extends localplay_controller {
public function install() {
-
} // install
/**
diff --git a/modules/localplay/mpd.controller.php b/modules/localplay/mpd.controller.php
index 8e067960..1ca7b4f5 100644
--- a/modules/localplay/mpd.controller.php
+++ b/modules/localplay/mpd.controller.php
@@ -109,6 +109,10 @@ class AmpacheMpd extends localplay_controller {
*/
public function is_installed() {
+ $sql = "DESCRIBE `localplay_mpd`";
+ $db_results = Dba::query($sql);
+
+ return Dba::num_rows($db_results);
} // is_installed
@@ -118,7 +122,18 @@ class AmpacheMpd extends localplay_controller {
*/
public function install() {
+ /* We need to create the MPD table */
+ $sql = "CREATE TABLE `localplay_mpd` ( `id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , " .
+ "`name` VARCHAR( 128 ) NOT NULL , " .
+ "`owner` INT( 11 ) NOT NULL , " .
+ "`host` VARCHAR( 255 ) NOT NULL , " .
+ "`port` INT( 11 ) UNSIGNED NOT NULL DEFAULT '6600', " .
+ "`password` VARCHAR( 255 ) NOT NULL , " .
+ "`access` SMALLINT( 4 ) UNSIGNED NOT NULL DEFAULT '0' " .
+ ") ENGINE = MYISAM";
+ $db_results = Dba::query($sql);
+ return true;
} // install
@@ -128,6 +143,10 @@ class AmpacheMpd extends localplay_controller {
*/
public function uninstall() {
+ $sql = "DROP TABLE `localplay_mpd`";
+ $db_results = Dba::query($sql);
+
+ return true;
} // uninstall
diff --git a/templates/show_localplay_controllers.inc.php b/templates/show_localplay_controllers.inc.php
index 3a45b481..cfbe7e30 100644
--- a/templates/show_localplay_controllers.inc.php
+++ b/templates/show_localplay_controllers.inc.php
@@ -31,13 +31,22 @@ $web_path = Config::get('web_path');
<?php
foreach ($controllers as $controller) {
$localplay = new Localplay($controller);
+ if (!$localplay->player_loaded()) { continue; }
$localplay->format();
+ if ($localplay->is_enabled()) {
+ $action = 'confirm_uninstall_localplay';
+ $action_txt = _('Disable');
+ }
+ else {
+ $action = 'install_localplay';
+ $action_txt = _('Activate');
+ }
?>
<tr class="<?php echo flip_class(); ?>">
<td><?php echo scrub_out($localplay->f_name); ?></td>
<td><?php echo scrub_out($localplay->f_description); ?></td>
<td><?php echo scrub_out($localplay->f_version); ?></td>
- <td><?php echo $action; ?></td>
+ <td><a href="<?php echo $web_path; ?>/admin/modules.php?action=<?php echo $action; ?>&amp;type="<?php urlencode($localplay->type); ?>"><?php echo $action_txt; ?></a></td>
</tr>
<?php } if (!count($controllers)) { ?>
<tr class="<?php echo flip_class(); ?>">