Esempio n. 1
0
BLK1;
require_once 'mpd-class/mpd.class.php';
$mpd = new mpd($host, $port, $password);
$pl = $mpd->GetDir();
if (isset($_GET['setTo'])) {
    if (in_array($_GET['setTo'], $pl['playlist'])) {
        //test for illegit data
        $mpd->PLLoad($_GET['setTo']);
    } elseif (isset($_GET['clear'])) {
        $mpd->PLClear();
    } elseif (isset($_GET['del'])) {
        //mpd.class tests for integer
        $mpd->PLRemove($_GET['del']);
    } elseif (isset($_GET['play'])) {
        //mpd.class tests for integer
        $mpd->SkipTo($_GET['play']);
        $mpd->Play();
    }
}
$me = basename($_SERVER['PHP_SELF']);
$rnd = substr(md5(rand()), 0, 8);
// having trouble with refreshes. this should convince the browser that everything's unique
print "<p><a href=\"playlist.php?{$rnd}\" accesskey=\"*\">*. Refresh</a> | ";
print "<a href=\"index.php?{$rnd}\" accesskey=\"#\">#. Back</a></p>\n";
print "<p><a href=\"{$me}?clear={$rnd}\">Clear Playlist</a></p>\n";
print "<h3>Available Playlists</h3>\n<p>";
foreach ($pl['playlist'] as $key => $val) {
    print "<a href=\"{$me}?setTo={$val}&{$rnd}\">{$val}</a><br />\n";
}
print "</p>\n\n<h3>Current Playlist</h3>\n<p>\n";
$pl = $mpd->playlist;
Esempio n. 2
0
         break;
     case 'prev':
         $mpd->Previous();
         header('Location: ./#current');
         break;
     case 'next':
         $mpd->Next();
         header('Location: ./#current');
         break;
     case 'stop':
         $mpd->Stop();
         header('Location: ./#current');
         break;
     case 'start':
         $songID = (int) $_GET['id'];
         $mpd->SkipTo($songID);
         header('Location: ./#current');
         break;
     case 'clearpl':
         $mpd->PLClear();
         header('Location: ./');
         break;
     case 'remove':
         $songID = (int) $_GET['id'];
         $mpd->SendCommand('deleteid', $songID);
         $mpd->RefreshInfo();
         header('Location: ./#current');
         break;
 }
 switch ($mpd->state) {
     case 'play':
Esempio n. 3
0
    $Mpd->Stop();
}
if ($_GET["action"] == "next") {
    $Mpd->Next();
}
if ($_GET["action"] == "previous") {
    $Mpd->Previous();
}
if ($_GET["action"] == "totalqueue") {
    echo "Playlist ";
    echo "<br />";
    echo $playlistcount . " songs";
}
if ($_GET["action"] == "play") {
    if (preg_match('/^\\d+$/', $_GET["num"])) {
        $Mpd->SkipTo($_GET["num"]);
    }
}
if ($_GET["action"] == "volume") {
    if (!$_GET["set"]) {
        if ($Mpd->volume != -1) {
            echo $Mpd->volume;
        } else {
            echo "N/A";
        }
    } elseif ($_GET["set"] == "up") {
        $Mpd->AdjustVolume(+5);
    } elseif ($_GET["set"] == "down") {
        $Mpd->AdjustVolume(-5);
    }
}
Esempio n. 4
0
// Control
switch ($action) {
    case "Play":
        $mpd->Play();
        break;
    case "Pause":
        $mpd->Pause();
        break;
    case "Next":
        $mpd->Next();
        break;
    case "Previous":
        $mpd->Previous();
        break;
    case "SkipTo":
        $mpd->SkipTo($track);
        break;
    case "RandomOn":
        $mpd->SetRandom(1);
        break;
    case "RandomOff":
        $mpd->SetRandom(0);
        break;
    case "RepeatOn":
        $mpd->SetRepeat(1);
        break;
    case "RepeatOff":
        $mpd->SetRepeat(0);
        break;
    case "VolumeUp":
        $mpd->AdjustVolume(5);