function get_overlay_context_from_title($contextTitle = null) { global $mvDefaultStreamViewLength, $wgTitle; if (!$contextTitle) { $contextTitle = $wgTitle; } $mvContextTitle = new MV_Title($contextTitle); $mvContextTitle->setStartEndIfEmpty(); $this->start_time = $mvContextTitle->getStartTimeSeconds(); $this->end_time = $mvContextTitle->getEndTimeSeconds(); $this->duration = $mvContextTitle->getDuration(); }
function mvDoMetavidStreamPage(&$title, &$article) { $mvTitle = new MV_Title($title->mDbkeyform); if ($mvTitle->doesStreamExist()) { // @@TODO check if we have /name corresponding to a view or // /ss:ss:ss or /ss:ss:ss/ee:ee:ee corresponding to a time request // force metavid to be special // (@@todo clean up skin.php to enable better tab controls) // $title->mNamespace= NS_SPECIAL; // add a hit to the digest if enabled: // @@todo (maybe in the future use javascript to confirm they acutally "watched" the clip) global $mvEnableClipViewDigest, $wgRequest; // don't log views without end times (default stream view) if ($mvEnableClipViewDigest && $mvTitle->end_time != null && $wgRequest->getVal('tl') != '1') { $dbw = wfGetDB(DB_WRITE); $dbw->insert('mv_clipview_digest', array('stream_id' => $mvTitle->getStreamId(), 'start_time' => $mvTitle->getStartTimeSeconds(), 'end_time' => $mvTitle->getEndTimeSeconds(), 'query_key' => $mvTitle->getStreamId() . $mvTitle->getStartTimeSeconds() . $mvTitle->getEndTimeSeconds(), 'view_date' => time())); // compensate for $mvDefaultClipRange around clips global $mvDefaultClipRange; $start_time = $mvTitle->getStartTimeSeconds() + $mvDefaultClipRange < 0 ? 0 : $mvTitle->getStartTimeSeconds() + $mvDefaultClipRange; $end_time = $mvTitle->getEndTimeSeconds() - $mvDefaultClipRange > $mvTitle->getDuration() ? 0 : $mvTitle->getEndTimeSeconds() - $mvDefaultClipRange; // also increment the mvd_page if we find a match: $dbw->update('mv_mvd_index', array('`view_count`=`view_count`+1'), array('stream_id' => $mvTitle->getStreamId(), 'start_time' => $start_time, 'end_time' => $end_time)); // print $dbw->lastQuery(); // also update the mvd_page if directly requested: $dbw->update('mv_mvd_index', array('`view_count`=`view_count`+1'), array('stream_id' => $mvTitle->getStreamId(), 'start_time' => $mvTitle->getStartTimeSeconds(), 'end_time' => $mvTitle->getEndTimeSeconds())); // print $dbw->lastQuery(); } // @@todo check if the requested title is already just the stream name: $streamTitle = Title::newFromText($mvTitle->getStreamName(), MV_NS_STREAM); // print " new title: " . $streamTitle . "\n"; $article = new MV_StreamPage($streamTitle, $mvTitle); } else { mvMissingStreamPage($mvTitle->stream_name); } }