'blogs', * 'page callback' => 'blog_page', * 'access arguments' => array('access content'), * 'type' => MENU_SUGGESTED_ITEM, *); */ $items['stream'] = array( 'title' => 'Icecast Stream', 'page callback' => 'icecast_page', 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, ); return $items; } /** * Implements hook_theme() */ function icecast_page_theme() { return array( 'icecast_page' => array( 'arguments' => array('listen_url' => NULL), 'template' => 'icecast_page', ), 'qwebirc' => array( 'arguments' => array('mount' => NULL), 'template' => 'qwebirc', ), 'icecast_page_footer' => array( 'arguments' => array('listen_url' => NULL), 'template' => 'icecast_page_footer', ), ); } /** * Page callback. * * @param $sid * Stream Id. */ function icecast_page($sid = NULL) { $sid = (int) $sid; $query = 'SELECT server_name, description, listen_url FROM {yp_stream} WHERE sid = %d'; $result = db_fetch_array(db_query(db_rewrite_sql($query), $sid)); if ($sid == NULL || empty($result['listen_url'])) { drupal_not_found(); return; } drupal_set_title(t('Live: @server_name', array('@server_name' => check_plain($result['server_name'])))); $mount = basename($result['listen_url'], '.ogg'); $mount = basename($mount, '.ogv'); $mount = basename($mount, '.mp3'); $output = theme('icecast_page', $result['listen_url']); $output .= theme('qwebirc', $mount); $output .= theme('icecast_page_footer', $result['listen_url']); return $output; }