Exemplo n.º 1
0
 function xmlrpc2php($d)
 {
     if ($d->kindOf() == "scalar") {
         return $d->scalarval();
     } elseif ($d->kindOf() == "array") {
         $a = array();
         for ($i = 0; $i < $d->arraysize(); $i++) {
             $a[$i] = XML_RPC_PLN::xmlrpc2php($d->arraymem($i));
         }
         return $a;
     } elseif ($d->kindOf() == "struct") {
         $a = array();
         while (list($k, $v) = $d->structeach()) {
             $a[$k] = XML_RPC_PLN::xmlrpc2php($v);
         }
         return $a;
     }
     //error ?
     return "";
 }
Exemplo n.º 2
0
 function getTrackXMLRPC($params)
 {
     $params = $this->findTrackID($params);
     $a = $this->getTrackArray($params["id"]);
     return XML_RPC_PLN::php2xmlrpc($a);
 }
Exemplo n.º 3
0
    $rated_tracks = XML_RPC_PLN::xmlrpc2php($rep->value());
    echo "<!-- XMLRPC CALL : \n" . $msg->serialize() . "\n -->";
    //debug
    //for each rated track, get metadata
    for ($i = 0; $i < count($rated_tracks); $i++) {
        $tracks_ids[$i] = array("id" => $rated_tracks[$i]["id"]);
    }
    $msg = new XML_RPC_Message("irate.getInfo", array(XML_RPC_PLN::php2xmlrpc($tracks_ids)));
    $rep = $XMLRPC->send($msg);
    $tracks_metadata = XML_RPC_PLN::xmlrpc2php($rep->value());
    echo "<!-- XMLRPC CALL : \n" . $msg->serialize() . "\n -->";
    //debug
    //ask for one new track
    $msg = new XML_RPC_Message("irate.getNew", array(XML_RPC_PLN::php2xmlrpc(array("n" => 1))));
    $rep = $XMLRPC->send($msg);
    $new_track = XML_RPC_PLN::xmlrpc2php($rep->value());
    echo "<!-- XMLRPC CALL : \n" . $msg->serialize() . "\n -->";
    //debug
    //that's it ! now we only need to display the tracks.
    ?>

<table border=1>
<tr>
 <th>Track name</th>
 <th>Artist name</th>
 <th>Crediturl</th>
 <th>Duration</th>
 <th>Rated</th>
 <th>Rate again ?</th>
</tr>