function get_export_page($stream_title) { global $wgUser, $wgRequest; $req_time = $wgRequest->getVal('time_range') ? '/' . $wgRequest->getVal('time_range') : ''; $mvTitle = new MV_Title($stream_title . $req_time); $sk = $wgUser->getSkin(); $out = '<h3>' . wfMsg('mv_tool_export_title') . '</h3>'; $tr = $wgRequest->getVal('time_range'); // @@todo pull in metadata layer selector (populated by current selection set) // makeKnownLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '', $style = '' ) $sTitle = SpecialPage::getTitleFor('MvExportStream'); $out .= $sk->makeKnownLinkObj($sTitle, wfMsg('mv_export_cmml'), 'feed_format=cmml&stream_name=' . $stream_title . '&t=' . $tr); $out .= ' for ' . $mvTitle->getTitleDesc(); return $out; }
function parsePlaylist() { global $wgParser, $wgOut; //valid playlist in-line-attributes: $mvInlineAttr = array('wClip', 'mvClip', 'title', 'linkback', 'desc', 'desc', 'image'); //build a associative array of "clips" $seq_text = $this->getSequenceText(); $seq_lines = explode("\n", $seq_text); $parseBucket = $cur_attr = ''; $clip_inx = -1; foreach ($seq_lines as $line) { //actions start with | $e = strpos($line, '='); if ($e !== false) { $cur_attr = substr($line, 1, $e - 1); } if (in_array($cur_attr, $mvInlineAttr)) { if ($cur_attr == 'mvClip') { $clip_inx++; } //close the parse bucket (found a valid inline attr) if ($parseBucket != '' && $cur_attr != 'desc') { $output = $wgParser->parse($parseBucket, $parser->mTitle, $parser->mOptions, true, false); $parseBucket = ''; } } $start_pos = $e !== false ? $e + 1 : 0; if ($clip_inx != -1) { if (!isset($this->clips[$clip_inx])) { $this->clips[$clip_inx] = array(); } if (!isset($this->clips[$clip_inx][$cur_attr])) { $this->clips[$clip_inx][$cur_attr] = ''; } $this->clips[$clip_inx][$cur_attr] .= substr($line, $start_pos); } } //poluate data (this could go here or somewhere else) foreach ($this->clips as $inx => &$clip) { if (trim($clip['mvClip']) == '') { unset($this->clips[$inx]); continue; } if ($clip['mvClip']) { $sn = str_replace('?t=', '/', $clip['mvClip']); $streamTitle = new MV_Title($sn); $wgStreamTitle = Title::newFromText($sn, MV_NS_STREAM); if ($streamTitle->doesStreamExist()) { //mvClip is a substitue for src so assume its there: $clip['src'] = $streamTitle->getWebStreamURL(); //title if (!isset($clip['title'])) { $clip['title'] = ''; } if ($clip['title'] == '') { $clip['title'] = $streamTitle->getTitleDesc(); } if (!isset($clip['info'])) { $clip['info'] = ''; } if ($clip['info'] == '') { $clip['info'] = $wgStreamTitle->getFullURL(); } } //check if we should look up the image: if (!isset($clip['image'])) { $clip['image'] == ''; } if ($clip['image'] == '') { $clip['image'] = $streamTitle->getFullStreamImageURL(); } //check if desc was present: if (!isset($clip['desc'])) { $clip['desc'] = ''; } //for now just lookup all ... @@todo future expose diffrent language tracks if ($clip['desc'] == '') { $dbr =& wfGetDB(DB_SLAVE); $mvd_res = MV_Index::getMVDInRange($streamTitle->getStreamId(), $streamTitle->getStartTimeSeconds(), $streamTitle->getEndTimeSeconds()); if (count($dbr->numRows($mvd_res)) != 0) { $MV_Overlay = new MV_Overlay(); $wgOut->clearHTML(); while ($mvd = $dbr->fetchObject($mvd_res)) { //output a link /line break $MV_Overlay->outputMVD($mvd); $wgOut->addHTML('<br>'); } $clip['desc'] = $wgOut->getHTML(); $wgOut->clearHTML(); } } } } //print_r($this->clips); }