Net_MPD
[ class tree: Net_MPD ] [ index: Net_MPD ] [ all elements ]

Source for file Admin.php

Documentation is available at Admin.php

  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.0 of the PHP license
  9.  * that is available thorugh the world-wide-web at the following URI:
  10.  * http://www.php.net/license/3_0.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_0.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.             try {
  39.                 return $this->runCommand('outputs');
  40.             catch (PEAR_Exception $e{
  41.                 throw new PEAR_Exception($e->getMessage()$e);
  42.             }
  43.         }
  44.     
  45.     /**
  46.      * Disables an audio output
  47.      * 
  48.      * @param $id int output Id to disable
  49.      * @return bool 
  50.      */
  51.     public function disableOutput($id)
  52.         {
  53.             try {
  54.                 if ($this->runCommand('disableoutput'$id== array()) {
  55.                     return true;
  56.                 }
  57.                 return false;
  58.             catch (PEAR_Exception $e{
  59.                 throw new PEAR_Exception($e->getMessage()$e);
  60.             }
  61.         }
  62.     
  63.     /**
  64.      * Enables an audio output
  65.      * 
  66.      * @param $id int Id to enable
  67.      * @return bool 
  68.      */
  69.     public function enableOutput($id)
  70.         {
  71.             try {
  72.                 if ($this->runCommand('enableoutput'$id== array()) {
  73.                     return true;
  74.                 }
  75.                 return false;
  76.             catch (PEAR_Exception $e{
  77.                 throw new PEAR_Exception($e->getMessage()$e);
  78.             }
  79.         }
  80.     
  81.     /**
  82.      * Kills the MPD server in a safe way, saving state if possible
  83.      * 
  84.      * @return bool 
  85.      */
  86.     public function kill()
  87.         {
  88.             try {
  89.                 $r $this->runCommand('kill');
  90.                 if ($r{
  91.                     @$this->disconnect();
  92.                 }
  93.                 return true;
  94.             catch (PEAR_Exception $e{
  95.                 throw new PEAR_Exception($e->getMessage()$e);
  96.             }
  97.         }
  98.     
  99.     /**
  100.      * Updates the music database
  101.      * 
  102.      * @param $path string path which to search for music, optional
  103.      * @return bool 
  104.      */
  105.     public function updateDatabase($path '')
  106.         {
  107.             try {
  108.                 $this->runCommand('update'$path);
  109.             catch (PEAR_Exception $e{
  110.                 throw new PEAR_Exception($e->getMessage()$e);
  111.             }
  112.             return true;
  113.         }
  114. }

Documentation generated on Mon, 11 Mar 2019 14:48:00 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.