Ejemplo n.º 1
0
Archivo: ajax.php Proyecto: k3x/VoteMPD
     $r = doVoteAlbum($_SERVER['REMOTE_ADDR'], $_GET["name"], $vote);
     doOutput(null, "voteAlbum");
     break;
 case "votePlaylist":
     if (!isset($_GET["name"])) {
         doError("No name specified");
     }
     if (!isset($_GET["vote"])) {
         doError("No vote specified");
     }
     $vote = $_GET["vote"] == "true";
     $r = doVotePlaylist($_SERVER['REMOTE_ADDR'], $_GET["name"], $vote);
     doOutput(null, "votePlaylist");
     break;
 case "getmyvotes":
     $r = doGetmyvotes();
     if ($r === false) {
         doError("Error while getting your votes");
     } else {
         doOutput($r, "getmyvotes");
     }
     break;
 case "getnextsong":
     doOutput(getNextsongInHighscore(), "getnextsong");
     break;
 case "mpdcurrent":
     $r = getMpdCurrentSong();
     if ($r === false) {
         doError("mpdcurrent failed");
     } else {
         doOutput($r, "mpdcurrent");
Ejemplo n.º 2
0
function doDownloadFilelist()
{
    $z = getMpdCurrentSong();
    if ($z["state"] != "play" || !isset($z["fileinfos"])) {
        $z = array();
    } else {
        $z = array($z["fileinfos"]);
    }
    $a = array();
    $b = array();
    $c = array();
    $d = array();
    $already = array();
    foreach ($z as $item) {
        if (!in_array($item->id, $already)) {
            $a[] = $item;
            $already[] = $item->id;
        }
    }
    foreach (doGetmyvotes() as $item) {
        if (!in_array($item->id, $already)) {
            $b[] = $item;
            $already[] = $item->id;
        }
    }
    foreach (doShowhighscore() as $item) {
        if (!in_array($item->id, $already)) {
            $c[] = $item;
            $already[] = $item->id;
        }
    }
    foreach (getBrowsePlaylog(10)["files"] as $item) {
        if (!in_array($item->id, $already)) {
            $d[] = $item;
            $already[] = $item->id;
        }
    }
    return array("a" => $a, "b" => $b, "c" => $c, "d" => $d);
}