connected == FALSE ) { echo "Error Connecting: " . $myMpd->errStr; } else { switch ($_REQUEST[m]) { case "add": if ( is_null($myMpd->PLAdd($_REQUEST[filename])) ) echo "ERROR: " .$myMpd->errStr.""; break; case "rem": if ( is_null($myMpd->PLRemove($_REQUEST[id])) ) echo "ERROR: " .$myMpd->errStr.""; break; case "setvol": if ( is_null($myMpd->SetVolume($_REQUEST[vol])) ) echo "ERROR: " .$myMpd->errStr.""; break; case "play": if ( is_null($myMpd->Play()) ) echo "ERROR: " .$myMpd->errStr.""; break; case "stop": if ( is_null($myMpd->Stop()) ) echo "ERROR: " .$myMpd->errStr.""; break; case "pause": if ( is_null($myMpd->Pause()) ) echo "ERROR: " .$myMpd->errStr.""; break; default: break; } ?>
[ Refresh Page ]

Connected to MPD Version mpd_version ?> at host ?>:port ?>
State: state) { case MPD_STATE_PLAYING: echo "MPD is Playing [Pause] [Stop]"; break; case MPD_STATE_PAUSED: echo "MPD is Paused [Unpause]"; break; case MPD_STATE_STOPPED: echo "MPD is Stopped [Play]"; break; default: echo "(Unknown State!)"; break; } ?>
Volume: volume ?> [ 0 | 25 | 75 | 100 ]
Uptime: uptime) ?>
Playtime: playtime) ?>
state == MPD_STATE_PLAYING or $myMpd->state == MPD_STATE_PAUSED ) { ?> Currently Playing: playlist[$myMpd->current_track_id]['Artist']." - ".$myMpd->playlist[$myMpd->current_track_id]['Title'] ?>
Track Position: current_track_position."/".$myMpd->current_track_length." (".(round(($myMpd->current_track_position/$myMpd->current_track_length),2)*100)."%)" ?>
Playlist Position: current_track_id+1)."/".$myMpd->playlist_count." (".(round((($myMpd->current_track_id+1)/$myMpd->playlist_count),2)*100)."%)" ?>

Playlist - Total: playlist_count ?> tracks (Click to Remove)
playlist) ) echo "ERROR: " .$myMpd->errStr."\n"; else { foreach ($myMpd->playlist as $id => $entry) { echo ( $id == $myMpd->current_track_id ? "" : "" ) . ($id+1) . ". ".$entry['Artist']." - ".$entry['Title']."".( $id == $myMpd->current_track_id ? "" : "" )."
\n"; } } ?>
Sample Search for the String 'U2' (Click to Add to Playlist)
Search(MPD_SEARCH_ARTIST,'U2'); if ( is_null($sl) ) echo "ERROR: " .$myMpd->errStr."\n"; else { foreach ($sl as $id => $entry) { echo ($id+1) . ": ".$entry['Artist']." - ".$entry['Title']."
\n"; } } if ( count($sl) == 0 ) echo "No results returned from search."; // Example of how you would use Bulk Add features of MPD // $myarray = array(); // $myarray[0] = "ACDC - Thunderstruck.mp3"; // $myarray[1] = "ACDC - Back In Black.mp3"; // $myarray[2] = "ACDC - Hells Bells.mp3"; // if ( is_null($myMpd->PLAddBulk($myarray)) ) echo "ERROR: ".$myMpd->errStr."\n"; ?>
Artist List
GetArtists()) ) echo "ERROR: " .$myMpd->errStr."\n"; else { while(list($key, $value) = each($ar) ) { echo ($key+1) . ". " . $value . "
"; } } $myMpd->Disconnect(); } // --------------------------------------------------------------------------------- // Used to make number of seconds perty. function secToTimeStr($secs) { $days = ($secs%604800)/86400; $hours = (($secs%604800)%86400)/3600; $minutes = ((($secs%604800)%86400)%3600)/60; $seconds = (((($secs%604800)%86400)%3600)%60); if (round($days)) $timestring .= round($days)."d "; if (round($hours)) $timestring .= round($hours)."h "; if (round($minutes)) $timestring .= round($minutes)."m"; if (!round($minutes)&&!round($hours)&&!round($days)) $timestring.=" ".round($seconds)."s"; return $timestring; } // -------------------------------------------------------------------------------- ?>