2
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
5
* LICENSE: GNU General Public License, version 2 (GPLv2)
6
* Copyright 2001 - 2013 Ampache.org
8
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public License v2
10
* as published by the Free Software Foundation.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
* localplay_controller Class
26
* This is the abstract class for any localplay controller
29
abstract class localplay_controller {
32
abstract public function add_url(Stream_URL $url); // Takes an array of song_ids
33
abstract public function delete_track($object_id); // Takes a single object_id and removes it from the playlist
34
abstract public function play();
35
abstract public function stop();
36
abstract public function get();
37
abstract public function connect();
38
abstract public function status();
39
abstract public function get_version(); // Returns the version of this plugin
40
abstract public function get_description(); // Returns the description
41
abstract public function is_installed(); // Returns an boolean t/f
42
abstract public function install();
43
abstract public function uninstall();
45
// For display we need the following 'instance' functions
46
abstract public function add_instance($data);
47
abstract public function delete_instance($id);
48
abstract public function update_instance($id,$post);
49
abstract public function get_instances();
50
abstract public function instance_fields();
51
abstract public function set_active_instance($uid);
52
abstract public function get_active_instance();
56
* This returns the URL for the passed object
58
public function get_url($object) {
60
// This might not be an object!
61
if (!is_object($object)) {
62
// Stupiidly we'll just blindly add it for now
66
$class = get_class($object);
68
$url = call_user_func(array($class,'play_url'),$object->id);
76
* This returns the Filename for the passed object, not
79
public function get_file($object) {
86
* This takes an Ampache URL and then returns the 'primary' part of it
87
* So that it's easier for localplay modules to return valid song information
89
public function parse_url($url) {
91
// Define possible 'primary' keys
92
$primary_array = array('oid','demo_id','random');
95
$variables = parse_url($url,PHP_URL_QUERY);
96
parse_str($variables,$data);
98
foreach ($primary_array as $pkey) {
100
$data['primary_key'] = $pkey;
110
} // end localplay_controller interface