// prepare playlist for streaming into icecast $fp = fopen($tmpfile, 'wb'); /* TODO: add jingle $jinglefile = $repo->getStationJingle($station); if (!is_object($jinglefile)) { fwrite($fp,$jinglefile . "\n"); } */ fwrite($fp, $filepath . "\n"); fclose($fp); // prepare streaming command $mp3info = GetAllMP3info($filepath); $bitrate = (string) $mp3info['mpeg']['audio']['bitrate']; $mystreamCmd = str_replace('__PLAYLIST__', $tmpfile, $streamCmd); $mystreamCmd = str_replace('__NAME__', $name, $mystreamCmd); $mystreamCmd = str_replace('__BITRATE__', $bitrate, $mystreamCmd); debug("Cmd", $mystreamCmd); debug("Url", $url); exec($mystreamCmd); //$res = exec($mystreamCmd); //debug("Cmd output", $res); // send playlist to client header("Content-type: audio/x-mpegurl\n"); //header("Content-transfer-encoding: binary\n"); header("Content-length: " . strlen($url) . "\n"); // send playlist echo $url; // save stats $prg->addStat($file->get('filename'), 'listens');