Ejemplo n.º 1
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;
}
Ejemplo n.º 2
0
Session::open();
// Fetch MPD status
$status = _parseStatusResponse(mpdStatus($mpd));
// Register player state in session
$_SESSION['state'] = $status['state'];
Session::close();
// Check and compare GUI state with Backend state
// MPD idle timeout loop, mpdMonitorState() waits until something changes in MPD then returns status
if ($_GET['state'] == $status['state']) {
    $status = mpdMonitorState($mpd);
}
// make sure song ist defined
$song = isset($status['song']) ? $status['song'] : '';
$status['x_status'] = $status;
$status['x_currentsong'] = _parseMpdCurrentSong(execMpdCommand($mpd, 'currentsong'));
$status['x_playlistinfo'] = _parseFileListResponse(execMpdCommand($mpd, "playlistinfo " . $song));
// get track info for currently playing track
$queue = mpdQueueTrackInfo($mpd, $song);
if (isset($queue[0])) {
    $track = $queue[0];
    // TODO check moving this to mpdEnrichItem
    $status['fileext'] = pathinfo($track['file'], PATHINFO_EXTENSION);
    // TODO use standard names instead of current xyz
    $status['currentartist'] = isset($track['Artist']) ? $track['Artist'] : '';
    $status['currentsong'] = isset($track['Title']) ? $track['Title'] : '';
    $status['currentalbum'] = isset($track['Album']) ? $track['Album'] : '';
    // experimental
    mpdEnrichItemInfo($track);
    $status = array_merge($status, $track);
}
closeMpdSocket($mpd);
Ejemplo n.º 3
0
function searchDB($sock, $type, $query = '')
{
    if ('' !== $query) {
        $query = ' "' . html_entity_decode($query) . '"';
    }
    switch ($type) {
        case "filepath":
            $resp = execMpdCommand($sock, "lsinfo " . $query);
            break;
        case "album":
        case "artist":
        case "title":
        case "file":
            $resp = execMpdCommand($sock, "search " . $type . $query);
            break;
    }
    return _parseFileListResponse($resp);
}
Ejemplo n.º 4
0
function findPLposPath($songpos, $mpd)
{
    sendMpdCommand($mpd, 'playlistinfo ' . $songpos);
    $idinfo = _parseFileListResponse(readMpdResponse($mpd));
    $path = $idinfo[0]['file'];
    return $path;
}