示例#1
0
// or using autoload
ini_set('display_errors', '1');
include 'connection.php';
// read current session parameters
session_start();
session_write_close();
// fetch MPD status
$status = _parseStatusResponse(MpdStatus($mpd));
$curTrack = getTrackInfo($mpd, $status['song']);
if (isset($curTrack[0]['Title'])) {
    $status['currentartist'] = $curTrack[0]['Artist'];
    $status['currentsong'] = $curTrack[0]['Title'];
    $status['currentalbum'] = $curTrack[0]['Album'];
    $status['fileext'] = parseFileStr($curTrack[0]['file'], '.');
}
$currentpath = "/mnt/" . findPLposPath($status['song'], $mpd);
//echo $currentpath;
$flac = new Zend_Media_Flac($currentpath);
// Extract picture
if ($flac->hasMetadataBlock(Zend_Media_Flac::PICTURE)) {
    header('Content-Type: ' . $flac->getPicture()->getMimeType());
    echo $flac->getPicture()->getData();
} else {
    $ch = curl_init(ui_lastFM_coverart($status['currentartist'], $status['currentalbum'], $_SESSION['lastfm_apikey']));
    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $image = curl_exec($ch);
    curl_close($ch);
    header('Content-Type: ' . mime_content_type($image));
    echo $image;
示例#2
0
function remTrackQueue($sock, $songpos)
{
    $datapath = findPLposPath($songpos, $sock);
    sendMpdCommand($sock, "delete " . $songpos);
    $response = readMpdResponse($sock);
    return $datapath;
}
示例#3
0
// --------------------- MPD ---------------------
if ($activePlayer === 'MPD') {
    // output switch
    $output = 0;
    include 'getid3/audioinfo.class.php';
    // get Last.FM api-key
    $lastfm_apikey = $redis->get('lastfm_apikey');
    // get HTTP proxy settings
    $proxy = $redis->hGetall('proxy');
    // connect to MPD daemon
    $mpd2 = openMpdSocket('/run/mpd.sock', 0);
    // fetch MPD status
    $status = _parseStatusResponse(MpdStatus($mpd2));
    $curTrack = getTrackInfo($mpd2, $status['song']);
    $mpdRoot = "/mnt/MPD/";
    $trackMpdPath = findPLposPath($status['song'], $mpd2);
    $currentpath = $mpdRoot . $trackMpdPath;
    closeMpdSocket($mpd2);
    // debug
    runelog("MPD current path", $currentpath);
    $request_uri = urldecode($_SERVER['REQUEST_URI']);
    runelog("HTTP GET request_uri (urldecoded)", $request_uri);
    $request_folder = substr(substr($request_uri, 0, strrpos($request_uri, "/")), 10);
    runelog("HTTP GET (request_folder)", $request_folder);
    $request_coverfile = substr($request_uri, strrpos($request_uri, "/") + 1);
    runelog("HTTP GET (request_coverfile)", $request_coverfile);
    $current_mpd_folder = substr(substr($currentpath, 0, strrpos($currentpath, "/")), 9);
    runelog("MPD (current_mpd_folder)", $current_mpd_folder);
    // --------------------- Spotify ---------------------
} elseif ($redis->get('activePlayer') === 'Spotify') {
    runelog('rune_PL_wrk: open SPOP socket');