getListenUrl(); } } else { header('HTTP/1.1 404 Not Found', true); die("No such PID.\n"); } // Logging try { $mountpoint = Mountpoint::retrieveByPk($p_id); if ($mountpoint instanceOf Mountpoint) { $sn = $mountpoint->getStreamName(); statsLog::playlistAccessed($p_id, $sn); } } catch (SQLException $e) { // Nothing to do, it's just logging after all... } /******************************************************************************/ /* VIEW */ /******************************************************************************/ switch ($file_type) { case FILE_TYPE_M3U: // Header header("Content-type: audio/x-mpegurl"); if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { header("Content-Disposition: filename=\"listen.m3u\""); } else { header("Content-Disposition: inline; filename=\"listen.m3u\""); } // Data echo implode("\r\n", $playlist)."\r\n"; break; case FILE_TYPE_XSPF: // Header header("Content-type: application/xspf+xml"); if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { header("Content-Disposition: filename=\"listen.xspf\""); } else { header("Content-Disposition: inline; filename=\"listen.xspf\""); } // Data $mountpoint = Mountpoint::retrieveByPk($p_id); printf(' %s %s ', $mountpoint->getStreamName(), $mountpoint->getUrl()); foreach ($playlist as $p) { printf(" %s\n", $p); } echo ' '; break; } ?>