~ubuntu-branches/debian/sid/ampache/sid

« back to all changes in this revision

Viewing changes to lib/class/localplay_controller.abstract.php

  • Committer: Package Import Robot
  • Author(s): Charlie Smotherman
  • Date: 2013-08-27 13:19:48 UTC
  • mfrom: (1.2.9)
  • Revision ID: package-import@ubuntu.com-20130827131948-1czew0zxn6u70dtv
Tags: 3.6-rzb2752+dfsg-1
* New upsteam snapshot.  Contains important bug fixes to the installer.
* Correct typo in ampache-common.postrm.
* Remove courtousy copy of php-getid3, during repack.  Closes: #701526
* Update package to use dh_linktree to make the needed sym links to the
  needed system libs that were removed during repack.
* Update debian/rules to reflect upstreams removing/moving of modules.
* Update debian/ampache-common.install to reflect upstreams removal of files.
* Updated to use new apache2.4 API. Closes: #669756
* Updated /debian/po/de.po thx David Prévot for the patch.  Closes:  #691963
* M3U import is now ordered, fixed upstream.  Closes: #684984
* Text input area has been resized so IPv6 addresses will now fit, fixed
  upstream.  Closes:  #716230
* Added ampache-common.preinst to make sure that the courtousy copies of code
  dirs are empty so dh_linktree can do it's magic on upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
 
3
/**
 
4
 *
 
5
 * LICENSE: GNU General Public License, version 2 (GPLv2)
 
6
 * Copyright 2001 - 2013 Ampache.org
 
7
 *
 
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.
 
11
 *
 
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.
 
16
 *
 
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.
 
20
 *
 
21
 */
 
22
 
 
23
/*
 
24
 * localplay_controller Class
 
25
 *
 
26
 * This is the abstract class for any localplay controller
 
27
 *
 
28
 */
 
29
abstract class localplay_controller {
 
30
 
 
31
    // Required Functions
 
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();
 
44
 
 
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();
 
53
 
 
54
    /**
 
55
     * get_url
 
56
     * This returns the URL for the passed object
 
57
     */
 
58
    public function get_url($object) {
 
59
 
 
60
        // This might not be an object!
 
61
        if (!is_object($object)) {
 
62
            // Stupiidly we'll just blindly add it for now
 
63
            return $object;
 
64
        }
 
65
 
 
66
        $class = get_class($object);
 
67
 
 
68
        $url = call_user_func(array($class,'play_url'),$object->id);
 
69
 
 
70
        return $url;
 
71
 
 
72
    } // get_url
 
73
 
 
74
    /**
 
75
     * get_file
 
76
     * This returns the Filename for the passed object, not
 
77
     * always possible
 
78
     */
 
79
    public function get_file($object) {
 
80
 
 
81
 
 
82
    } // get_file
 
83
 
 
84
    /**
 
85
     * parse_url
 
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
 
88
     */
 
89
    public function parse_url($url) {
 
90
 
 
91
        // Define possible 'primary' keys
 
92
        $primary_array = array('oid','demo_id','random');
 
93
        $data = array();
 
94
 
 
95
        $variables = parse_url($url,PHP_URL_QUERY);
 
96
        parse_str($variables,$data);
 
97
 
 
98
        foreach ($primary_array as $pkey) {
 
99
            if ($data[$pkey]) {
 
100
                $data['primary_key'] = $pkey;
 
101
                return $data;
 
102
            }
 
103
 
 
104
        } // end foreach
 
105
 
 
106
        return $data;
 
107
 
 
108
    } // parse_url
 
109
 
 
110
} // end localplay_controller interface