]>
Commit | Line | Data |
---|---|---|
964dd0bc JW |
1 | <?php |
2 | /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ | |
3 | /** | |
4 | * Music Player Daemon API | |
5 | * | |
6 | * PHP Version 5 | |
7 | * | |
8 | * LICENSE: This source file is subject to version 3.01 of the PHP license | |
9 | * that is available thorugh the world-wide-web at the following URI: | |
10 | * http://www.php.net/license/3_01.txt. If you did not receive a copy of | |
11 | * the PHP License and are unable to obtain it through the web, please | |
12 | * send a note to license@php.net so we can mail you a copy immediately. | |
13 | * | |
14 | * | |
15 | * | |
16 | * API for the administrative portion of Music Player Daemon commands | |
17 | * | |
18 | * Used for maintaining and controlling various administrative tasks | |
19 | * of the MPD software. | |
20 | * | |
21 | * @category Networking | |
22 | * @package Net_MPD | |
23 | * @author Graham Christensen <graham.christensen@itrebal.com> | |
24 | * @copyright 2006 Graham Christensen | |
25 | * @license http://www.php.net/license/3_01.txt | |
26 | * @version CVS: $ID:$ | |
27 | */ | |
28 | class Net_MPD_Admin extends Net_MPD_Common | |
29 | { | |
30 | ||
31 | /** | |
32 | * List available audio outputs | |
33 | * | |
34 | * @return array or int on failure | |
35 | */ | |
36 | public function getOutputs() | |
37 | { | |
38 | return $this->runCommand('outputs'); | |
39 | } | |
40 | ||
41 | /** | |
42 | * Disables an audio output | |
43 | * | |
44 | * @param $id int output Id to disable | |
45 | * @return bool | |
46 | */ | |
47 | public function disableOutput($id) | |
48 | { | |
49 | return $this->runCommand('disableoutput', $id); | |
50 | } | |
51 | ||
52 | /** | |
53 | * Enables an audio output | |
54 | * | |
55 | * @param $id int Id to enable | |
56 | * @return bool | |
57 | */ | |
58 | public function enableOutput($id) | |
59 | { | |
60 | return $this->runCommand('enableoutput', $id); | |
61 | } | |
62 | ||
63 | /** | |
64 | * Kills the MPD server in a safe way, saving state if possible | |
65 | * | |
66 | * @return bool | |
67 | */ | |
68 | public function kill() | |
69 | { | |
70 | $r = $this->runCommand('kill'); | |
71 | if ($r) { | |
72 | @$this->disconnect(); | |
73 | } | |
74 | return true; | |
75 | } | |
76 | ||
77 | /** | |
78 | * Updates the music database | |
79 | * | |
80 | * @param $path string path which to search for music, optional | |
81 | * @return bool | |
82 | */ | |
83 | public function updateDatabase($path = '') | |
84 | { | |
85 | $this->runCommand('update', $path); | |
86 | return true; | |
87 | } | |
88 | } | |
89 | ?> |