public static function parsePlaylist($resp) { if (is_null($resp)) { return null; } else { $dirCounter = -1; $plistArray = array(); $plistLine = strtok($resp, "\n"); // $plistFile = ""; $plCounter = -1; $browseMode = TRUE; while ($plistLine) { if ($plistLine == "OK") { break; } // list ( $element, $value ) = explode(": ",$plistLine); if (!strpos($plistLine, '@eaDir')) { list($element, $value) = explode(': ', $plistLine, 2); } if ($element === 'file' or $element === 'playlist') { $plCounter++; $browseMode = FALSE; // $plistFile = $value; $plistArray[$plCounter][$element] = $value; $plistArray[$plCounter]['fileext'] = parseFileStr($value, '.'); } elseif ($element === 'directory') { $plCounter++; // record directory index for further processing $dirCounter++; // $plistFile = $value; $plistArray[$plCounter]['directory'] = $value; } else { if ($browseMode) { if ($element === 'Album') { $plCounter++; $plistArray[$plCounter]['album'] = $value; } else { if ($element === 'Artist') { $plCounter++; $plistArray[$plCounter]['artist'] = $value; } else { if ($element === 'Genre') { $plCounter++; $plistArray[$plCounter]['genre'] = $value; } } } } else { $plistArray[$plCounter][$element] = $value; // $plistArray[$plCounter]['Time2'] = songTime($plistArray[$plCounter]['Time']); } } $plistLine = strtok("\n"); } } return $plistArray; }
function rp_addPlay($path, $mpd, $pos) { $song = parseFileStr($path, "/"); $ramplaypath = "ramplay/" . $song; $_SESSION['DEBUG'] .= "rp_addPlay:{$id} {$song} {$path} {$pos}|"; addQueue($mpd, $ramplaypath); sendMpdCommand($mpd, 'play ' . $pos); }
// ----- check and compare GUI state with Backend state ---- // // idle LOOP if ($_GET['state'] == $status['state']) { $status = monitorMpdState($mpd); } // idle LOOP // ----- check and compare GUI state with Backend state ---- // $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'], '.'); } else { $path = parseFileStr($curTrack[0]['file'], '/'); $status['fileext'] = parseFileStr($curTrack[0]['file'], '.'); $status['currentartist'] = ""; $status['currentsong'] = $song; $status['currentalbum'] = "path: " . $path; } // CMediaFix if (isset($_SESSION['cmediafix']) && $_SESSION['cmediafix'] == 1 && $status['state'] == 'play') { $status['lastbitdepth'] = $_SESSION['lastbitdepth']; if ($_SESSION['lastbitdepth'] != $status['audio']) { sendMpdCommand($mpd, 'cmediafix'); } } // Ramplay if (isset($_SESSION['ramplay']) && $_SESSION['ramplay'] == 1) { // set consume mode ON // if ($status['consume'] == 0) {
break; case 'addradio': if ($activePlayer === 'MPD') { // input array= $_POST['radio']['label'] $_POST['radio']['url'] wrk_control($redis, 'newjob', $data = array('wrkcmd' => 'webradio', 'action' => 'add', 'args' => $_POST['radio'])); } break; case 'editradio': if ($activePlayer === 'MPD') { // input array= $_POST['radio']['label'] $_POST['radio']['newlabel'] $_POST['radio']['url'] wrk_control($redis, 'newjob', $data = array('wrkcmd' => 'webradio', 'action' => 'edit', 'args' => $_POST['radio'])); } break; case 'readradio': if ($activePlayer === 'MPD') { $name = parseFileStr(parseFileStr($_POST['filename'], '.', 1), '/'); echo json_encode(array('name' => $name, 'url' => $redis->hGet('webradios', $name))); } break; case 'deleteradio': if ($activePlayer === 'MPD') { // input array= $_POST['radio']['label'] wrk_control($redis, 'newjob', $data = array('wrkcmd' => 'webradio', 'action' => 'delete', 'args' => $_POST['radio'])); } break; case 'test': $proxy = $redis->hGetall('proxy'); print_r($proxy); break; case 'albumadd': if ($activePlayer === 'MPD') {
function ui_status($mpd, $status) { $curTrack = getTrackInfo($mpd, $status['song']); if (isset($curTrack[0]['Title'])) { $status['currentartist'] = $curTrack[0]['Artist']; $status['currentsong'] = htmlentities($curTrack[0]['Title'], ENT_XML1, 'UTF-8'); $status['currentalbum'] = $curTrack[0]['Album']; $status['fileext'] = parseFileStr($curTrack[0]['file'], '.'); } else { $path = parseFileStr($curTrack[0]['file'], '/'); $status['fileext'] = parseFileStr($curTrack[0]['file'], '.'); $status['currentartist'] = ""; // $status['currentsong'] = $song; if (!empty($path)) { $status['currentalbum'] = $path; } else { $status['currentalbum'] = ''; } } $status['radioname'] = $curTrack[0]['Name']; return $status; }