コード例 #1
0
 public static function settingsTest($app)
 {
     $socket = openMpdSocket('/run/mpd.sock');
     sendMpdCommand($socket, 'status');
     $song = readMpdResponse($socket);
     //        var_dump(self::parsePlaylist($song));
     echo json_encode(playerController::parsePlaylist($song));
 }
コード例 #2
0
function findPLposPath($songpos, $mpd)
{
    //$_SESSION['DEBUG'] .= "rp_findPath:$id |";
    sendMpdCommand($mpd, 'playlistinfo ' . $songpos);
    $idinfo = _parseFileListResponse(readMpdResponse($mpd));
    $path = $idinfo[0]['file'];
    //$_SESSION['DEBUG'] .= "Path:$path |";
    return $path;
}
コード例 #3
0
ファイル: index.php プロジェクト: AlarWE/RootFS-RaspberryPI
                 sendMpdCommand($mpd, 'play ' . $pos);
                 echo json_encode(readMpdResponse($mpd));
             }
             break;
         case 'addreplaceplay':
             if (isset($_POST['path']) && $_POST['path'] != '') {
                 sendMpdCommand($mpd, 'clear');
                 addQueue($mpd, $_POST['path']);
                 sendMpdCommand($mpd, 'play');
                 echo json_encode(readMpdResponse($mpd));
             }
             break;
         case 'update':
             if (isset($_POST['path']) && $_POST['path'] != '') {
                 sendMpdCommand($mpd, "update \"" . html_entity_decode($_POST['path']) . "\"");
                 echo json_encode(readMpdResponse($mpd));
             }
             break;
         case 'trackremove':
             if (isset($_GET['songid']) && $_GET['songid'] != '') {
                 echo json_encode(remTrackQueue($mpd, $_GET['songid']));
             }
             break;
         case 'search':
             if (isset($_POST['query']) && $_POST['query'] != '' && isset($_GET['querytype']) && $_GET['querytype'] != '') {
                 echo json_encode(searchDB($mpd, $_GET['querytype'], $_POST['query']));
             }
             break;
     }
     closeMpdSocket($mpd);
 }
コード例 #4
0
ファイル: player.php プロジェクト: dermidgen/moode
function execMpdCommand($sock, $command)
{
    sendMpdCommand($sock, $command);
    return readMpdResponse($sock);
}
コード例 #5
0
 public static function currentSong($app)
 {
     $app->response->headers->set('Content-Type', 'application/json');
     $socket = openMpdSocket('/run/mpd.sock');
     sendMpdCommand($socket, 'currentsong');
     $song = readMpdResponse($socket);
     $obj = array("song" => self::parsePlaylist($song));
     echo json_encode($obj);
 }
コード例 #6
0
 public static function playlistRemove($app, $num)
 {
     $socket = openMpdSocket('/run/mpd.sock');
     sendMpdCommand($socket, "deleteid " . $num);
     $infos = readMpdResponse($socket);
     var_dump($infos);
 }
コード例 #7
0
ファイル: index.php プロジェクト: adam-fonseca/RuneUI
         $socket = $mpd;
     } elseif ($activePlayer === 'Spotify') {
         $socket = $spop;
     }
     $response = ui_update($redis, $socket);
 } elseif ($_GET['cmd'] === 'wifiscan') {
     wrk_control($redis, 'newjob', $data = array('wrkcmd' => 'wificfg', 'action' => 'scan'));
     echo 'wlan scan queued';
     die;
 } else {
     if ($activePlayer === 'MPD') {
         sendMpdCommand($mpd, $_GET['cmd']);
         // debug
         // runelog('--- [command/index.php] --- CLOSE MPD SOCKET <<< (1) ---','');
         if (!$response) {
             $response = readMpdResponse($mpd);
         }
     } elseif ($activePlayer === 'Spotify') {
         // MPD -> SPOP command conversion
         if ($_GET['cmd'] === 'pause') {
             $_GET['cmd'] = 'toggle';
         }
         if ($_GET['cmd'] === 'clear') {
             $_GET['cmd'] = 'qclear';
             $redis->hIncrBy('spotify', 'plversion', 1);
         }
         if (strpos($_GET['cmd'], 'repeat') === 0) {
             $_GET['cmd'] = 'repeat';
         }
         if (strpos($_GET['cmd'], 'random') === 0) {
             $_GET['cmd'] = 'shuffle';
コード例 #8
0
ファイル: runeaudio.php プロジェクト: adam-fonseca/RuneUI
function ui_mpd_response($mpd, $notify = null)
{
    runelog('ui_mpd_response invoked');
    $response = json_encode(readMpdResponse($mpd));
    // --- TODO: check this condition
    if (strpos($response, "OK") && isset($notify)) {
        runelog('send UI notify: ', $notify);
        ui_notify($notify['title'], $notify['text']);
    }
    echo $response;
}