Esempio n. 1
0
$prg = new sotf_Programme($id);
if (empty($fileid)) {
    // find a file to listen
    $fileid = $prg->selectFileToListen();
    if (!$fileid) {
        raiseError("no_file_to_listen");
    }
}
$file = new sotf_NodeObject("sotf_media_files", $fileid);
if (!$prg->isLocal()) {
    raiseError("Currently you can listen only to programmes of local stations");
}
if ($prg->get('published') != 't' || $file->get('stream_access') != 't') {
    raiseError("no_listen_access");
}
$filepath = $prg->getFilePath($file);
$tmpfile = $tmpdir . "/{$id_}{$fileid}.m3u";
//$name = "$id_$fileid";
$name = "{$id_}" . time();
$url = 'http://' . $iceServer . ':' . $icePort . '/' . $name . "\n";
debug("file", $filepath);
if (!is_file($filepath)) {
    raiseError("no_such_file");
}
// 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");