diff --git a/config/.svn/all-wcprops b/config/.svn/all-wcprops
new file mode 100644
index 0000000..e898077
--- /dev/null
+++ b/config/.svn/all-wcprops
@@ -0,0 +1,11 @@
+K 25
+svn:wc:ra_dav:version-url
+V 29
+/svn/!svn/ver/28/trunk/config
+END
+config.inc.php
+K 25
+svn:wc:ra_dav:version-url
+V 44
+/svn/!svn/ver/28/trunk/config/config.inc.php
+END
diff --git a/config/.svn/entries b/config/.svn/entries
new file mode 100644
index 0000000..0b583ea
--- /dev/null
+++ b/config/.svn/entries
@@ -0,0 +1,62 @@
+10
+
+dir
+31
+https://neompc.googlecode.com/svn/trunk/config
+https://neompc.googlecode.com/svn
+
+
+
+2008-01-08T14:46:35.101904Z
+28
+danbee
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3182664f-f819-0410-8fcb-9f4c312bcbac
+
+config.inc.php
+file
+
+
+
+
+2009-07-01T07:29:50.000000Z
+40b1335c49a8dc77d9b4d3b942930167
+2008-01-08T14:46:35.101904Z
+28
+danbee
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+803
+
diff --git a/config/.svn/prop-base/config.inc.php.svn-base b/config/.svn/prop-base/config.inc.php.svn-base
new file mode 100644
index 0000000..bdbd305
--- /dev/null
+++ b/config/.svn/prop-base/config.inc.php.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 6
+native
+END
diff --git a/config/.svn/text-base/config.inc.php.svn-base b/config/.svn/text-base/config.inc.php.svn-base
new file mode 100644
index 0000000..3b45065
--- /dev/null
+++ b/config/.svn/text-base/config.inc.php.svn-base
@@ -0,0 +1,30 @@
+
diff --git a/config/config.inc.php b/config/config.inc.php
index 3b45065..6ee791b 100644
--- a/config/config.inc.php
+++ b/config/config.inc.php
@@ -11,15 +11,15 @@
/* Config relating to the display of CD covers */
/* music_directory must match you MPD music_directory config */
- $_CONFIG['music_directory'] = '/home/danbee/Music';
+ $_CONFIG['music_directory'] = '/pub/media/audio';
$_CONFIG['album_cover_name'] = 'folder.jpg';
/* Template to use for displaying the pages */
$_CONFIG['template'] = 'default';
/* Browse mode can be 'filesystem' or 'metadata' */
- $_CONFIG['browse_mode'] = 'metadata';
- //$_CONFIG['browse_mode'] = 'filesystem';
+ //$_CONFIG['browse_mode'] = 'metadata';
+ $_CONFIG['browse_mode'] = 'filesystem';
$_CONFIG['sort_by_tracknumber'] = true;
diff --git a/imagecache/.svn/all-wcprops b/imagecache/.svn/all-wcprops
new file mode 100644
index 0000000..25837c2
--- /dev/null
+++ b/imagecache/.svn/all-wcprops
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 33
+/svn/!svn/ver/12/trunk/imagecache
+END
diff --git a/imagecache/.svn/entries b/imagecache/.svn/entries
new file mode 100644
index 0000000..f11a37c
--- /dev/null
+++ b/imagecache/.svn/entries
@@ -0,0 +1,28 @@
+10
+
+dir
+31
+https://neompc.googlecode.com/svn/trunk/imagecache
+https://neompc.googlecode.com/svn
+
+
+
+2007-05-14T16:21:36.436919Z
+12
+danbee
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3182664f-f819-0410-8fcb-9f4c312bcbac
+
diff --git a/lib/.svn/all-wcprops b/lib/.svn/all-wcprops
new file mode 100644
index 0000000..fb0cf14
--- /dev/null
+++ b/lib/.svn/all-wcprops
@@ -0,0 +1,41 @@
+K 25
+svn:wc:ra_dav:version-url
+V 26
+/svn/!svn/ver/30/trunk/lib
+END
+javascript.js
+K 25
+svn:wc:ra_dav:version-url
+V 40
+/svn/!svn/ver/16/trunk/lib/javascript.js
+END
+page.php
+K 25
+svn:wc:ra_dav:version-url
+V 35
+/svn/!svn/ver/28/trunk/lib/page.php
+END
+actions.php
+K 25
+svn:wc:ra_dav:version-url
+V 38
+/svn/!svn/ver/28/trunk/lib/actions.php
+END
+global.php
+K 25
+svn:wc:ra_dav:version-url
+V 37
+/svn/!svn/ver/30/trunk/lib/global.php
+END
+image.php
+K 25
+svn:wc:ra_dav:version-url
+V 36
+/svn/!svn/ver/25/trunk/lib/image.php
+END
+mpd.class.php
+K 25
+svn:wc:ra_dav:version-url
+V 40
+/svn/!svn/ver/29/trunk/lib/mpd.class.php
+END
diff --git a/lib/.svn/entries b/lib/.svn/entries
new file mode 100644
index 0000000..6470f87
--- /dev/null
+++ b/lib/.svn/entries
@@ -0,0 +1,235 @@
+10
+
+dir
+31
+https://neompc.googlecode.com/svn/trunk/lib
+https://neompc.googlecode.com/svn
+
+
+
+2008-01-08T14:57:28.348799Z
+30
+danbee
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3182664f-f819-0410-8fcb-9f4c312bcbac
+
+smarty
+dir
+
+javascript.js
+file
+
+
+
+
+2009-07-01T07:30:01.000000Z
+ca31925d1a9f7827e66743ebaa115bc1
+2007-05-16T14:27:56.785226Z
+16
+danbee
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1319
+
+page.php
+file
+
+
+
+
+2009-07-01T07:30:01.000000Z
+f3995f27ad434f9540abc8e46b57fa54
+2008-01-08T14:46:35.101904Z
+28
+danbee
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+7284
+
+actions.php
+file
+
+
+
+
+2009-07-01T07:30:01.000000Z
+fb004463a888d1a601c810cc186130ae
+2008-01-08T14:46:35.101904Z
+28
+danbee
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2720
+
+global.php
+file
+
+
+
+
+2009-07-01T07:30:01.000000Z
+9f080d7d97ca430b1feefd832e3feece
+2008-01-08T14:57:28.348799Z
+30
+danbee
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2842
+
+image.php
+file
+
+
+
+
+2009-07-01T07:30:01.000000Z
+a204da84c85db9ad6701fb3c49fc6bc1
+2007-05-18T15:31:38.890175Z
+25
+danbee
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1051
+
+mpd.class.php
+file
+
+
+
+
+2009-07-01T07:30:01.000000Z
+fe5b7454037985a6ff03f16c515b5546
+2008-01-08T14:55:18.755817Z
+29
+danbee
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+31875
+
diff --git a/lib/.svn/prop-base/image.php.svn-base b/lib/.svn/prop-base/image.php.svn-base
new file mode 100644
index 0000000..bdbd305
--- /dev/null
+++ b/lib/.svn/prop-base/image.php.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 6
+native
+END
diff --git a/lib/.svn/prop-base/javascript.js.svn-base b/lib/.svn/prop-base/javascript.js.svn-base
new file mode 100644
index 0000000..bdbd305
--- /dev/null
+++ b/lib/.svn/prop-base/javascript.js.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 6
+native
+END
diff --git a/lib/.svn/text-base/actions.php.svn-base b/lib/.svn/text-base/actions.php.svn-base
new file mode 100644
index 0000000..02d14cb
--- /dev/null
+++ b/lib/.svn/text-base/actions.php.svn-base
@@ -0,0 +1,143 @@
+SkipTo($_GET['skipto']);
+ }
+
+ switch($_GET['action']) {
+ case "clear":
+ $mympd->PLClear();
+ break;
+
+ case "remove":
+ $mympd->PLRemove($_GET['id']);
+ break;
+
+ case "fileadd":
+ $mympd->PLAdd($_GET['file']);
+ break;
+
+ case "addall":
+ addall($_COOKIE['browse']);
+ $page = 'playlist';
+ setcookie('page', $page);
+ header("Location: index.php");
+ break;
+
+ case "playall":
+ $mympd->PLClear();
+
+ addall($_COOKIE['browse']);
+
+ $page = 'control';
+ setcookie('page', $page);
+ $mympd->Play();
+ header("Location: index.php");
+ break;
+
+ case "fileplay":
+ $mympd->PLClear();
+ $mympd->PLAdd($_GET['file']);
+ $page = 'control';
+ setcookie('page', $page);
+ $mympd->Play();
+ header("Location: index.php");
+ break;
+
+ case "play":
+ $mympd->Play();
+ header("Location: index.php");
+ break;
+
+ case "stop":
+ $mympd->Stop();
+ header("Location: index.php");
+ break;
+
+ case "pause":
+ $mympd->Pause();
+ header("Location: index.php");
+ break;
+
+ case "prev":
+ $mympd->Previous();
+ header("Location: index.php");
+ break;
+
+ case "next":
+ $mympd->Next();
+ header("Location: index.php");
+ break;
+ }
+
+ function addall($browse) {
+
+ global $_CONFIG, $mympd;
+
+ if ($browse == $_CONFIG['separator']) {
+ $browse = '';
+ }
+
+ switch ($_CONFIG['browse_mode']) {
+
+ case 'filesystem':
+
+ function get_browselist($path) {
+
+ global $mympd;
+
+ $browselist = $mympd->GetDir($path);
+
+ foreach ($browselist as $browseitem) {
+ if ($browseitem['directory']) {
+ //echo $browseitem.directory;
+ $browselist = array_merge($browselist, get_browselist($browseitem['directory']));
+ }
+ }
+
+ return $browselist;
+
+ }
+
+ /* create the array of files for the playlist add */
+ $browselist = get_browselist($browse);
+
+ break;
+
+ case 'metadata':
+
+ $browse_bits = explode($_CONFIG['separator'], $browse);
+
+ if (is_array($browse_bits)) {
+
+ if ($browse_bits[1]) {
+ $album = $browse_bits[1];
+ $browselist = $mympd->Find(MPD_SEARCH_ALBUM, $album);
+ }
+ elseif ($browse_bits[0]) {
+ $artist = $browse_bits[0];
+ $browselist = $mympd->Find(MPD_SEARCH_ARTIST, $artist);
+ }
+
+ }
+ else {
+ //$browselist = $mympd->Search(MPD_SEARCH_TITLE, '');
+ }
+
+ break;
+ }
+
+ if (is_array($browselist)) {
+
+ foreach($browselist as $browselist_item) {
+ if ($browselist_item['file']) {
+ $addlist[] = $browselist_item['file'];
+ }
+ }
+
+ $mympd->PLAddBulk($addlist);
+ }
+
+ }
+?>
diff --git a/lib/.svn/text-base/global.php.svn-base b/lib/.svn/text-base/global.php.svn-base
new file mode 100644
index 0000000..21c3a63
--- /dev/null
+++ b/lib/.svn/text-base/global.php.svn-base
@@ -0,0 +1,104 @@
+template_dir = 'templates/';
+ $smarty->compile_dir = 'smarty/templates_c/';
+ $smarty->config_dir = 'smarty/configs/';
+ $smarty->cache_dir = 'smarty/cache/';
+
+ $smarty->assign('version', $version);
+ $smarty->assign('template', $_CONFIG['template']);
+
+ require("templates/${_CONFIG['template']}/config.inc.php");
+
+ include('lib/mpd.class.php');
+ if ($_CONFIG['password'] != '') {
+ $mympd = new mpd($_CONFIG['server'], $_CONFIG['port'], $_CONFIG['password']);
+ }
+ else {
+ $mympd = new mpd($_CONFIG['server'], $_CONFIG['port']);
+ }
+
+ if (!$mympd->connected) {
+ echo "
Problem connecting to MPD!
";
+ exit;
+ }
+
+ /* track number sorting function */
+
+ function track_sort($a, $b) {
+ if ($a['directory'] && $b['directory']) {
+ if ($a['directory'] < $b['directory']) {
+ return -1;
+ }
+ elseif ($a['directory'] > $b['directory']) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+ elseif ($a['directory'] && !$b['directory']) {
+ return 1;
+ }
+ elseif (!$a['directory'] && $b['directory']) {
+ return -1;
+ }
+ else {
+ return $a['Track'] - $b['Track'];
+ }
+ }
+
+ /* setup some global vars */
+ $smarty->assign('browse_link', 'index.php?page=browse');
+ $smarty->assign('playlist_link', 'index.php?page=playlist');
+ $smarty->assign('browselist_play_link', 'index.php?action=fileplay&file=');
+ $smarty->assign('browselist_add_link', 'index.php?action=fileadd&file=');
+ $smarty->assign('playlist_remove_link', 'index.php?action=remove&id=');
+ $smarty->assign('control_link', 'index.php?page=control');
+ $smarty->assign('playlist_play_link', 'index.php?page=control&action=play&skipto=');
+ $smarty->assign('playlist_clear_link', 'index.php?action=clear');
+ $smarty->assign('mpd_state', $mympd->state);
+
+ /* first check for a page cookie, and default to displaying the playlist */
+ if ($_GET['page']) {
+ $page = $_GET['page'];
+ setcookie('page', $page);
+ }
+ else {
+ $page = $_COOKIE['page'];
+ }
+
+ if (!$page) {
+ $page = 'playlist';
+ }
+
+ //echo $mympd->current_track_length, ' - ', $mympd->current_track_position;
+
+ $smarty->assign('page', $page);
+
+?>
diff --git a/lib/.svn/text-base/image.php.svn-base b/lib/.svn/text-base/image.php.svn-base
new file mode 100644
index 0000000..d6fb070
--- /dev/null
+++ b/lib/.svn/text-base/image.php.svn-base
@@ -0,0 +1,40 @@
+ $ratio_orig) {
+ $width = $height*$ratio_orig;
+ } else {
+ $height = $width/$ratio_orig;
+ }
+
+ // Resample
+ $image_p = imagecreatetruecolor($width, $height);
+ $image = imagecreatefromjpeg($filename);
+ imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
+
+ // Output
+ imagejpeg($image_p, $cache_file_name, 95);
+
+ }
+
+ echo file_get_contents($cache_file_name);
+?>
diff --git a/lib/.svn/text-base/javascript.js.svn-base b/lib/.svn/text-base/javascript.js.svn-base
new file mode 100644
index 0000000..4472ffa
--- /dev/null
+++ b/lib/.svn/text-base/javascript.js.svn-base
@@ -0,0 +1,58 @@
+
+ song_length = {$song_length};
+ song_position = {$song_position};
+
+ song_min = {$initialmin};
+ song_sec = {$initialsec};
+
+ mpd_state = '{$mpd_state}';
+
+ {literal}
+
+ update_int = null;
+
+ function format_time(number) {
+ if (number < 10) {
+ return '0' + number.toString();
+ }
+ else {
+ return number.toString();
+ }
+ }
+
+ function update_progress() {
+
+ //set the interval if it hasn't been set already.
+ if (update_int == null) {
+ update_int = setInterval('update_progress()', 1000);
+ }
+
+ if (song_position < song_length) {
+ song_position = song_position + 1;
+ song_sec = song_sec + 1;
+ if (song_sec >= 60) {
+ song_sec = 0;
+ song_min = song_min + 1
+ }
+ }
+
+ progressbar = document.getElementById('progressbar');
+
+ new_margin = Math.round(200 - ((song_position / song_length) * 200));
+
+ new_margin_string = new_margin + 'px';
+
+ progressbar.style.marginRight = new_margin_string;
+ document.getElementById('min').innerHTML = format_time(song_min);
+ document.getElementById('sec').innerHTML = format_time(song_sec);
+
+ //alert(progressbar.style.marginRight + ' - ' + new_margin_string);
+
+ }
+
+ if (mpd_state == 'play') {
+ //start off with a shorter interval. this should make the whole thing a little more accurate.
+ setTimeout('update_progress()', 750);
+ }
+
+ {/literal}
diff --git a/lib/.svn/text-base/mpd.class.php.svn-base b/lib/.svn/text-base/mpd.class.php.svn-base
new file mode 100644
index 0000000..7af900c
--- /dev/null
+++ b/lib/.svn/text-base/mpd.class.php.svn-base
@@ -0,0 +1,980 @@
+host = $srv;
+ $this->port = $port;
+ $this->password = $pwd;
+
+ $resp = $this->Connect();
+ if ( is_null($resp) ) {
+ $this->errStr = "Could not connect";
+ return;
+ } else {
+ list ( $this->mpd_version ) = sscanf($resp, MPD_RESPONSE_OK . " MPD %s\n");
+ if ( ! is_null($pwd) ) {
+ if ( is_null($this->SendCommand(MPD_CMD_PASSWORD,$pwd)) ) {
+ $this->connected = FALSE;
+ return; // bad password or command
+ }
+ if ( is_null($this->RefreshInfo()) ) { // no read access -- might as well be disconnected!
+ $this->connected = FALSE;
+ $this->errStr = "Password supplied does not have read access";
+ return;
+ }
+ } else {
+ if ( is_null($this->RefreshInfo()) ) { // no read access -- might as well be disconnected!
+ $this->connected = FALSE;
+ $this->errStr = "Password required to access server";
+ return;
+ }
+ }
+ }
+ }
+
+ /* Connect()
+ *
+ * Connects to the MPD server.
+ *
+ * NOTE: This is called automatically upon object instantiation; you should not need to call this directly.
+ */
+ function Connect() {
+ if ( $this->debugging ) echo "mpd->Connect() / host: ".$this->host.", port: ".$this->port."\n";
+ $this->mpd_sock = fsockopen($this->host,$this->port,$errNo,$errStr,10);
+ if (!$this->mpd_sock) {
+ $this->errStr = "Socket Error: $errStr ($errNo)";
+ return NULL;
+ } else {
+ while(!feof($this->mpd_sock)) {
+ $response = fgets($this->mpd_sock,1024);
+ if (strncmp(MPD_RESPONSE_OK,$response,strlen(MPD_RESPONSE_OK)) == 0) {
+ $this->connected = TRUE;
+ return $response;
+ break;
+ }
+ if (strncmp(MPD_RESPONSE_ERR,$response,strlen(MPD_RESPONSE_ERR)) == 0) {
+ $this->errStr = "Server responded with: $response";
+ return NULL;
+ }
+ }
+ // Generic response
+ $this->errStr = "Connection not available";
+ return NULL;
+ }
+ }
+
+ /* SendCommand()
+ *
+ * Sends a generic command to the MPD server. Several command constants are pre-defined for
+ * use (see MPD_CMD_* constant definitions above).
+ */
+ function SendCommand($cmdStr,$arg1 = "",$arg2 = "") {
+ if ( $this->debugging ) echo "mpd->SendCommand() / cmd: ".$cmdStr.", args: ".$arg1." ".$arg2."\n";
+ if ( ! $this->connected ) {
+ echo "mpd->SendCommand() / Error: Not connected\n";
+ } else {
+ // Clear out the error String
+ $this->errStr = "";
+ $respStr = "";
+
+ // Check the command compatibility:
+ if ( ! $this->_checkCompatibility($cmdStr) ) {
+ return NULL;
+ }
+
+ if (strlen($arg1) > 0) {
+ $arg1 = str_replace("\"", "\\\"", $arg1);
+ $cmdStr .= " \"$arg1\"";
+ }
+ if (strlen($arg2) > 0) {
+ $arg2 = str_replace("\"", "\\\"", $arg2);
+ $cmdStr .= " \"$arg2\"";
+ }
+ fputs($this->mpd_sock,"$cmdStr\n");
+ while(!feof($this->mpd_sock)) {
+ $response = fgets($this->mpd_sock,1024);
+
+ // An OK signals the end of transmission -- we'll ignore it
+ if (strncmp(MPD_RESPONSE_OK,$response,strlen(MPD_RESPONSE_OK)) == 0) {
+ break;
+ }
+
+ // An ERR signals the end of transmission with an error! Let's grab the single-line message.
+ if (strncmp(MPD_RESPONSE_ERR,$response,strlen(MPD_RESPONSE_ERR)) == 0) {
+ list ( $junk, $errTmp ) = split(MPD_RESPONSE_ERR . " ",$response );
+ $this->errStr = strtok($errTmp,"\n");
+ }
+
+ if ( strlen($this->errStr) > 0 ) {
+ return NULL;
+ }
+
+ // Build the response string
+ $respStr .= $response;
+ }
+ if ( $this->debugging ) echo "mpd->SendCommand() / response: '".$respStr."'\n";
+ }
+ return $respStr;
+ }
+
+ /* QueueCommand()
+ *
+ * Queues a generic command for later sending to the MPD server. The CommandQueue can hold
+ * as many commands as needed, and are sent all at once, in the order they are queued, using
+ * the SendCommandQueue() method. The syntax for queueing commands is identical to SendCommand().
+ */
+ function QueueCommand($cmdStr,$arg1 = "",$arg2 = "") {
+ if ( $this->debugging ) echo "mpd->QueueCommand() / cmd: ".$cmdStr.", args: ".$arg1." ".$arg2."\n";
+ if ( ! $this->connected ) {
+ echo "mpd->QueueCommand() / Error: Not connected\n";
+ return NULL;
+ } else {
+ if ( strlen($this->command_queue) == 0 ) {
+ $this->command_queue = MPD_CMD_START_BULK . "\n";
+ }
+ if (strlen($arg1) > 0) {
+ $arg1 = str_replace("\"", "\\\"", $arg1);
+ $cmdStr .= " \"$arg1\"";
+ }
+ if (strlen($arg2) > 0) {
+ $arg2 = str_replace("\"", "\\\"", $arg2);
+ $cmdStr .= " \"$arg2\"";
+ }
+
+ $this->command_queue .= $cmdStr ."\n";
+
+ if ( $this->debugging ) echo "mpd->QueueCommand() / return\n";
+ }
+ return TRUE;
+ }
+
+ /* SendCommandQueue()
+ *
+ * Sends all commands in the Command Queue to the MPD server. See also QueueCommand().
+ */
+ function SendCommandQueue() {
+ if ( $this->debugging ) echo "mpd->SendCommandQueue()\n";
+ if ( ! $this->connected ) {
+ echo "mpd->SendCommandQueue() / Error: Not connected\n";
+ return NULL;
+ } else {
+ $this->command_queue .= MPD_CMD_END_BULK . "\n";
+ if ( is_null($respStr = $this->SendCommand($this->command_queue)) ) {
+ return NULL;
+ } else {
+ $this->command_queue = NULL;
+ if ( $this->debugging ) echo "mpd->SendCommandQueue() / response: '".$respStr."'\n";
+ }
+ }
+ return $respStr;
+ }
+
+ /* AdjustVolume()
+ *
+ * Adjusts the mixer volume on the MPD by , which can be a positive (volume increase),
+ * or negative (volume decrease) value.
+ */
+ function AdjustVolume($modifier) {
+ if ( $this->debugging ) echo "mpd->AdjustVolume()\n";
+ if ( ! is_numeric($modifier) ) {
+ $this->errStr = "AdjustVolume() : argument 1 must be a numeric value";
+ return NULL;
+ }
+
+ $this->RefreshInfo();
+ $newVol = $this->volume + $modifier;
+ $ret = $this->SetVolume($newVol);
+
+ if ( $this->debugging ) echo "mpd->AdjustVolume() / return\n";
+ return $ret;
+ }
+
+ /* SetVolume()
+ *
+ * Sets the mixer volume to , which should be between 1 - 100.
+ */
+ function SetVolume($newVol) {
+ if ( $this->debugging ) echo "mpd->SetVolume()\n";
+ if ( ! is_numeric($newVol) ) {
+ $this->errStr = "SetVolume() : argument 1 must be a numeric value";
+ return NULL;
+ }
+
+ // Forcibly prevent out of range errors
+ if ( $newVol < 0 ) $newVol = 0;
+ if ( $newVol > 100 ) $newVol = 100;
+
+ // If we're not compatible with SETVOL, we'll try adjusting using VOLUME
+ if ( $this->_checkCompatibility(MPD_CMD_SETVOL) ) {
+ if ( ! is_null($ret = $this->SendCommand(MPD_CMD_SETVOL,$newVol))) $this->volume = $newVol;
+ } else {
+ $this->RefreshInfo(); // Get the latest volume
+ if ( is_null($this->volume) ) {
+ return NULL;
+ } else {
+ $modifier = ( $newVol - $this->volume );
+ if ( ! is_null($ret = $this->SendCommand(MPD_CMD_VOLUME,$modifier))) $this->volume = $newVol;
+ }
+ }
+
+ if ( $this->debugging ) echo "mpd->SetVolume() / return\n";
+ return $ret;
+ }
+
+ /* GetDir()
+ *
+ * Retrieves a database directory listing of the directory and places the results into
+ * a multidimensional array. If no directory is specified, the directory listing is at the
+ * base of the MPD music path.
+ */
+ function GetDir($dir = "") {
+ if ( $this->debugging ) echo "mpd->GetDir()\n";
+ $resp = $this->SendCommand(MPD_CMD_LSDIR,$dir);
+ $dirlist = $this->_parseFileListResponse($resp);
+ if ( $this->debugging ) echo "mpd->GetDir() / return ".print_r($dirlist)."\n";
+ return $dirlist;
+ }
+
+ /* PLAdd()
+ *
+ * Adds each track listed in a single-dimensional , which contains filenames
+ * of tracks to add, to the end of the playlist. This is used to add many, many tracks to
+ * the playlist in one swoop.
+ */
+ function PLAddBulk($trackArray) {
+ if ( $this->debugging ) echo "mpd->PLAddBulk()\n";
+ $num_files = count($trackArray);
+ for ( $i = 0; $i < $num_files; $i++ ) {
+ $this->QueueCommand(MPD_CMD_PLADD,$trackArray[$i]);
+ }
+ $resp = $this->SendCommandQueue();
+ $this->RefreshInfo();
+ if ( $this->debugging ) echo "mpd->PLAddBulk() / return\n";
+ return $resp;
+ }
+
+ /* PLAdd()
+ *
+ * Adds the file to the end of the playlist. must be a track in the MPD database.
+ */
+ function PLAdd($fileName) {
+ if ( $this->debugging ) echo "mpd->PLAdd()\n";
+ if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLADD,$fileName))) $this->RefreshInfo();
+ if ( $this->debugging ) echo "mpd->PLAdd() / return\n";
+ return $resp;
+ }
+
+ /* PLMoveTrack()
+ *
+ * Moves track number to position in the playlist. This is used to reorder
+ * the songs in the playlist.
+ */
+ function PLMoveTrack($origPos, $newPos) {
+ if ( $this->debugging ) echo "mpd->PLMoveTrack()\n";
+ if ( ! is_numeric($origPos) ) {
+ $this->errStr = "PLMoveTrack(): argument 1 must be numeric";
+ return NULL;
+ }
+ if ( $origPos < 0 or $origPos > $this->playlist_count ) {
+ $this->errStr = "PLMoveTrack(): argument 1 out of range";
+ return NULL;
+ }
+ if ( $newPos < 0 ) $newPos = 0;
+ if ( $newPos > $this->playlist_count ) $newPos = $this->playlist_count;
+
+ if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLMOVETRACK,$origPos,$newPos))) $this->RefreshInfo();
+ if ( $this->debugging ) echo "mpd->PLMoveTrack() / return\n";
+ return $resp;
+ }
+
+ /* PLShuffle()
+ *
+ * Randomly reorders the songs in the playlist.
+ */
+ function PLShuffle() {
+ if ( $this->debugging ) echo "mpd->PLShuffle()\n";
+ if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLSHUFFLE))) $this->RefreshInfo();
+ if ( $this->debugging ) echo "mpd->PLShuffle() / return\n";
+ return $resp;
+ }
+
+ /* PLLoad()
+ *
+ * Retrieves the playlist from .m3u and loads it into the current playlist.
+ */
+ function PLLoad($file) {
+ if ( $this->debugging ) echo "mpd->PLLoad()\n";
+ if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLLOAD,$file))) $this->RefreshInfo();
+ if ( $this->debugging ) echo "mpd->PLLoad() / return\n";
+ return $resp;
+ }
+
+ /* PLSave()
+ *
+ * Saves the playlist to .m3u for later retrieval. The file is saved in the MPD playlist
+ * directory.
+ */
+ function PLSave($file) {
+ if ( $this->debugging ) echo "mpd->PLSave()\n";
+ $resp = $this->SendCommand(MPD_CMD_PLSAVE,$file);
+ if ( $this->debugging ) echo "mpd->PLSave() / return\n";
+ return $resp;
+ }
+
+ /* PLClear()
+ *
+ * Empties the playlist.
+ */
+ function PLClear() {
+ if ( $this->debugging ) echo "mpd->PLClear()\n";
+ if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLCLEAR))) $this->RefreshInfo();
+ if ( $this->debugging ) echo "mpd->PLClear() / return\n";
+ return $resp;
+ }
+
+ /* PLRemove()
+ *
+ * Removes track from the playlist.
+ */
+ function PLRemove($id) {
+ if ( $this->debugging ) echo "mpd->PLRemove()\n";
+ if ( ! is_numeric($id) ) {
+ $this->errStr = "PLRemove() : argument 1 must be a numeric value";
+ return NULL;
+ }
+ if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLREMOVE,$id))) $this->RefreshInfo();
+ if ( $this->debugging ) echo "mpd->PLRemove() / return\n";
+ return $resp;
+ }
+
+ /* SetRepeat()
+ *
+ * Enables 'loop' mode -- tells MPD continually loop the playlist. The parameter
+ * is either 1 (on) or 0 (off).
+ */
+ function SetRepeat($repVal) {
+ if ( $this->debugging ) echo "mpd->SetRepeat()\n";
+ $rpt = $this->SendCommand(MPD_CMD_REPEAT,$repVal);
+ $this->repeat = $repVal;
+ if ( $this->debugging ) echo "mpd->SetRepeat() / return\n";
+ return $rpt;
+ }
+
+ /* SetRandom()
+ *
+ * Enables 'randomize' mode -- tells MPD to play songs in the playlist in random order. The
+ * parameter is either 1 (on) or 0 (off).
+ */
+ function SetRandom($rndVal) {
+ if ( $this->debugging ) echo "mpd->SetRandom()\n";
+ $resp = $this->SendCommand(MPD_CMD_RANDOM,$rndVal);
+ $this->random = $rndVal;
+ if ( $this->debugging ) echo "mpd->SetRandom() / return\n";
+ return $resp;
+ }
+
+ /* Shutdown()
+ *
+ * Shuts down the MPD server (aka sends the KILL command). This closes the current connection,
+ * and prevents future communication with the server.
+ */
+ function Shutdown() {
+ if ( $this->debugging ) echo "mpd->Shutdown()\n";
+ $resp = $this->SendCommand(MPD_CMD_SHUTDOWN);
+
+ $this->connected = FALSE;
+ unset($this->mpd_version);
+ unset($this->errStr);
+ unset($this->mpd_sock);
+
+ if ( $this->debugging ) echo "mpd->Shutdown() / return\n";
+ return $resp;
+ }
+
+ /* DBRefresh()
+ *
+ * Tells MPD to rescan the music directory for new tracks, and to refresh the Database. Tracks
+ * cannot be played unless they are in the MPD database.
+ */
+ function DBRefresh() {
+ if ( $this->debugging ) echo "mpd->DBRefresh()\n";
+ $resp = $this->SendCommand(MPD_CMD_REFRESH);
+
+ // Update local variables
+ $this->RefreshInfo();
+
+ if ( $this->debugging ) echo "mpd->DBRefresh() / return\n";
+ return $resp;
+ }
+
+ /* Play()
+ *
+ * Begins playing the songs in the MPD playlist.
+ */
+ function Play() {
+ if ( $this->debugging ) echo "mpd->Play()\n";
+ if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_PLAY) )) $this->RefreshInfo();
+ if ( $this->debugging ) echo "mpd->Play() / return\n";
+ return $rpt;
+ }
+
+ /* Stop()
+ *
+ * Stops playing the MPD.
+ */
+ function Stop() {
+ if ( $this->debugging ) echo "mpd->Stop()\n";
+ if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_STOP) )) $this->RefreshInfo();
+ if ( $this->debugging ) echo "mpd->Stop() / return\n";
+ return $rpt;
+ }
+
+ /* Pause()
+ *
+ * Toggles pausing on the MPD. Calling it once will pause the player, calling it again
+ * will unpause.
+ */
+ function Pause() {
+ if ( $this->debugging ) echo "mpd->Pause()\n";
+ if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_PAUSE) )) $this->RefreshInfo();
+ if ( $this->debugging ) echo "mpd->Pause() / return\n";
+ return $rpt;
+ }
+
+ /* SeekTo()
+ *
+ * Skips directly to the song in the MPD playlist.
+ */
+ function SkipTo($idx) {
+ if ( $this->debugging ) echo "mpd->SkipTo()\n";
+ if ( ! is_numeric($idx) ) {
+ $this->errStr = "SkipTo() : argument 1 must be a numeric value";
+ return NULL;
+ }
+ if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_PLAY,$idx))) $this->RefreshInfo();
+ if ( $this->debugging ) echo "mpd->SkipTo() / return\n";
+ return $idx;
+ }
+
+ /* SeekTo()
+ *
+ * Skips directly to a given position within a track in the MPD playlist. The argument,
+ * given in seconds, is the track position to locate. The