diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-09-12 07:30:55 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-09-12 07:30:55 +0000 |
commit | bff9e37fa5fa41111b5b06ce6cdcb0eb8e5c21f9 (patch) | |
tree | f9f61787479b286e5ae5efb96447107c10dd553e /modules | |
parent | c99ad11ee04fa811aaf6988a2daa0567ab6ee0d8 (diff) | |
download | ampache-bff9e37fa5fa41111b5b06ce6cdcb0eb8e5c21f9.tar.gz ampache-bff9e37fa5fa41111b5b06ce6cdcb0eb8e5c21f9.tar.bz2 ampache-bff9e37fa5fa41111b5b06ce6cdcb0eb8e5c21f9.zip |
more work on the localplay stuff, most details ironed out, just needs some code to back it up, also tweaked plugins and threw in some extra goodies in the preference class, also pimped out the error class
Diffstat (limited to 'modules')
-rw-r--r-- | modules/localplay/httpq.controller.php | 57 | ||||
-rw-r--r-- | modules/localplay/mpd.controller.php | 72 | ||||
-rw-r--r-- | modules/plugins/Lastfm.plugin.php | 10 | ||||
-rw-r--r-- | modules/plugins/OpenStrands.plugin.php | 5 |
4 files changed, 128 insertions, 16 deletions
diff --git a/modules/localplay/httpq.controller.php b/modules/localplay/httpq.controller.php index 7e812792..fde12a9d 100644 --- a/modules/localplay/httpq.controller.php +++ b/modules/localplay/httpq.controller.php @@ -128,14 +128,63 @@ class AmpacheHttpq extends localplay_controller { } // uninstall /** - * actions - * List all the special kick ass things you can do with MPD + * add_instance + * This takes key'd data and inserts a new MPD instance */ - public function actions() { + public function add_instance($data) { - } // actions + } // add_instance + + /** + * delete_instance + * This takes a UID and deletes the instance in question + */ + public function delete_instance($uid) { + + + } // delete_instance + + /** + * get_instances + * This returns a key'd array of the instance information with + * [UID]=>[NAME] + */ + public function get_instances() { + + + } // get_instances + + /** + * instance_fields + * This returns a key'd array of [NAME]=>array([DESCRIPTION]=>VALUE,[TYPE]=>VALUE) for the + * fields so that we can on-the-fly generate a form + */ + public function instance_fields() { + + + + } // instance_fields + + /** + * set_active_instance + * This sets the specified instance as the 'active' one + */ + public function set_active_instance($uid) { + + + } // set_active_instance + + /** + * get_active_instance + * This returns the UID of the current active instance + * false if none are active + */ + public function get_active_instance() { + + + } // get_active_instance /** * add diff --git a/modules/localplay/mpd.controller.php b/modules/localplay/mpd.controller.php index 1ca7b4f5..d7819c48 100644 --- a/modules/localplay/mpd.controller.php +++ b/modules/localplay/mpd.controller.php @@ -129,10 +129,13 @@ class AmpacheMpd extends localplay_controller { "`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' " . + "`access` SMALLINT( 4 ) UNSIGNED NOT NULL DEFAULT '0', " . ") ENGINE = MYISAM"; $db_results = Dba::query($sql); + // Add an internal preference for the users current active instance + Preference::insert('mpd_active','MPD Active Instance','0','25','integer','internal'); + return true; } // install @@ -151,14 +154,73 @@ class AmpacheMpd extends localplay_controller { } // uninstall /** - * actions - * List all the special kick ass things you can do with MPD + * add_instance + * This takes key'd data and inserts a new MPD instance + */ + public function add_instance($data) { + + + + } // add_instance + + /** + * delete_instance + * This takes a UID and deletes the instance in question + */ + public function delete_instance($uid) { + + + } // delete_instance + + /** + * get_instances + * This returns a key'd array of the instance information with + * [UID]=>[NAME] */ - public function actions() { + public function get_instances() { + } // get_instances + + /** + * instance_fields + * This returns a key'd array of [NAME]=>array([DESCRIPTION]=>VALUE,[TYPE]=>VALUE) for the + * fields so that we can on-the-fly generate a form + */ + public function instance_fields() { + + + + } // instance_fields + + /** + * set_active_instance + * This sets the specified instance as the 'active' one + */ + public function set_active_instance($uid,$user_id='') { + + // Not an admin? bubkiss! + if (!$GLOBALS['user']->has_access('100')) { + $user_id = $GLOBALS['user']->id; + } + + $user_id = $user_id ? $user_id : $GLOBALS['user']->id; + + Preference::update('mpd_instance',$user_id,intval($uid)); + + return true; + + } // set_active_instance + + /** + * get_active_instance + * This returns the UID of the current active instance + * false if none are active + */ + public function get_active_instance() { + - } // actions + } // get_active_instance /** * add diff --git a/modules/plugins/Lastfm.plugin.php b/modules/plugins/Lastfm.plugin.php index 098e01e8..0d9c4b18 100644 --- a/modules/plugins/Lastfm.plugin.php +++ b/modules/plugins/Lastfm.plugin.php @@ -70,10 +70,12 @@ class AmpacheLastfm { */ public function uninstall() { - /* We need to remove the preivously added preferences */ - $sql = "DELETE FROM `preference` WHERE `name`='lastfm_pass' OR `name`='lastfm_user' " . - "OR `name`='lastfm_url' OR `name`='lastfm_host' OR `name`='lastfm_port' OR `name`='lastfm_challenge'"; - $db_results = Dba::query($sql); + Preference::delete('lastfm_pass'); + Preference::delete('lastfm_user'); + Preference::delete('lastfm_url'); + Preference::delete('lastfm_host'); + Preference::delete('lastfm_port'); + Preference::delete('lastfm_challenge'); } // uninstall diff --git a/modules/plugins/OpenStrands.plugin.php b/modules/plugins/OpenStrands.plugin.php index f57529b9..d63e9616 100644 --- a/modules/plugins/OpenStrands.plugin.php +++ b/modules/plugins/OpenStrands.plugin.php @@ -57,9 +57,8 @@ class AmpacheOpenStrands { */ function uninstall() { - /* We need to remove the preivously added preferences */ - $sql = "DELETE FROM `preference` WHERE `name`='mystrands_pass' OR `name`='mystrands_user'"; - $db_results = Dba::query($sql); + Preference::delete('mystrands_pass'); + Preference::delete('mystrands_user'); } // uninstall |