public function execute() { $pageIds = $this->getPageSet()->getAllTitlesByNamespace(); // Make sure we have files in the title set: if (!empty($pageIds[NS_FILE])) { $titles = array_keys($pageIds[NS_FILE]); asort($titles); // Ensure the order is always the same $result = $this->getResult(); $images = RepoGroup::singleton()->findFiles($titles); foreach ($images as $img) { // if its a "transcode" add the transcode status table output if (TimedMediaHandlerHooks::isTranscodableTitle($img->getTitle())) { $transcodeStatus = WebVideoTranscode::getTranscodeState($img->getTitle()->getDBKey()); // remove useless properties foreach ($transcodeStatus as $key => &$val) { unset($val['id']); unset($val['image_name']); unset($val['key']); } $result->addValue(array('query', 'pages', $img->getTitle()->getArticleID()), 'transcodestatus', $transcodeStatus); } } } }
public static function getTranscodeRows( $file ){ global $wgUser; $o=''; $transcodeRows = WebVideoTranscode::getTranscodeState( $file->getTitle()->getDbKey() ); foreach( $transcodeRows as $transcodeKey => $state ){ $o.='<tr>'; // Status: $o.='<td>' . self::getStatusMsg( $file, $state ) . '</td>'; // Encode info: $o.='<td>' . wfMsgHtml('timedmedia-derivative-desc-' . $transcodeKey ) . '</td>'; // Download file $o.='<td>'; $o.= ( !is_null( $state['time_success'] ) ) ? '<a href="'.self::getSourceUrl( $file, $transcodeKey ) .'" title="'.wfMsg('timedmedia-download' ) .'"><div class="download-btn"></div></a></td>' : wfMsgHtml('timedmedia-not-ready' ); $o.='</td>'; // Check if we should include actions: if( $wgUser->isAllowed( 'transcode-reset' ) ){ // include reset transcode action buttons $o.='<td class="transcodereset"><a href="#" data-transcodekey="' . htmlspecialchars( $transcodeKey ). '">' . wfMsg('timedmedia-reset') . '</a></td>'; } $o.='</tr>'; } return $o; }
static public function checkTimeSinceLastRest( $fileName, $transcodeKey ){ global $wgWaitTimeForTranscodeReset; $transcodeStates = WebVideoTranscode::getTranscodeState( $fileName ); if( $transcodeKey ){ if( ! $transcodeStates[$transcodeKey] ){ // transcode key not found return $wgWaitTimeForTranscodeReset + 1; } return self::getStateResetTime( $transcodeStates[$transcodeKey] ); } // least wait is set to reset time: $leastWait = $wgWaitTimeForTranscodeReset + 1; // else check for lowest reset time foreach($transcodeStates as $tk => $state ){ $ctime = self::getStateResetTime( $state ); if( $ctime < $leastWait){ $leastWait = $ctime; } } return $leastWait; }