logo       

[MediaWiki-CVS] SVN: [54079] trunk/extensions/WikiAtHome: msg#01457

mediawiki-cvs

Subject: [MediaWiki-CVS] SVN: [54079] trunk/extensions/WikiAtHome

http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54079

Revision: 54079
Author: dale
Date: 2009-07-31 09:30:02 +0000 (Fri, 31 Jul 2009)

Log Message:
-----------
* updated api, configuration vars,
* updated readme / install instructions
* updated js interface

Modified Paths:
--------------
trunk/extensions/WikiAtHome/ApiWikiAtHome.php
trunk/extensions/WikiAtHome/NonFreeVideoHandler.php
trunk/extensions/WikiAtHome/README
trunk/extensions/WikiAtHome/SpecialWikiAtHome.php
trunk/extensions/WikiAtHome/WahJobManager.php
trunk/extensions/WikiAtHome/WikiAtHome.js
trunk/extensions/WikiAtHome/WikiAtHome.php

Modified: trunk/extensions/WikiAtHome/ApiWikiAtHome.php
===================================================================
--- trunk/extensions/WikiAtHome/ApiWikiAtHome.php 2009-07-31 08:52:31 UTC
(rev 54078)
+++ trunk/extensions/WikiAtHome/ApiWikiAtHome.php 2009-07-31 09:30:02 UTC
(rev 54079)
@@ -19,11 +19,11 @@
}

public function execute(){
- global $wgUser;
+ global $wgUser, $wgRequest;
$this->getMain()->isWriteMode();
$this->mParams = $this->extractRequestParams();
- $request = $this->getMain()->getRequest();
-
+ $request = $this->getMain()->getRequest();

+
// do token checks:
if( is_null( $this->mParams['token'] ) )
$this->dieUsageMsg( array( 'missingparam', 'token' ) );
@@ -32,108 +32,212 @@

//do actions:
if( $this->mParams['getnewjob'] ){
- if( isset( $this->mParams['jobset']) &&
$this->mParams['jobset']){
- $job = WahJobManager::getNewJob(
$this->mParams['jobset'] );
- }else{
- $job = WahJobManager::getNewJob();
- }
+ //do job req:
+ return $this->proccessJobReq();
+ }else if ( $this->mParams['jobkey'] ){
+ return $this->doProccessJobKey (
$this->mParams['jobkey'] ) ;
+ }
+ }
+ /*
+ * Process a newJob req:
+ */
+ function proccessJobReq(){
+
+ if( isset( $this->mParams['jobset']) &&
$this->mParams['jobset']){
+ $job = WahJobManager::getNewJob(
$this->mParams['jobset'] );
+ }else{
+ $job = WahJobManager::getNewJob();
+ }

- if(!$job){
- return $this->getResult()->addValue( null,
$this->getModuleName(),
- array(
- 'nojobs' => true
- )
- );
- }else{
- $job4Client = array();
- //unpack the $job_json
- $job4Client['job_json'] = json_decode(
$job->job_json ) ;
- //we set the job key to job_id _ sha1
- $job4Client['job_key'] = $job->job_id . '_'.
sha1( $job->job_json );
- $job4Client['job_title']= $job->title;
- $job4Client['job_ns'] = $job->ns;
- $job4Client['job_set_id'] = $job->job_set_id;
+ if(!$job){
+ return $this->getResult()->addValue( null,
$this->getModuleName(),
+ array(
+ 'nojobs' => true
+ )
+ );
+ }else{
+ $job4Client = array();
+ //unpack the $job_json
+ $job4Client['job_json'] = json_decode( $job->job_json )
;
+ //we set the job key to job_id _ sha1
+ $job4Client['job_key'] = $job->job_id . '_'. sha1(
$job->job_json );
+ $job4Client['job_title']= $job->title;
+ $job4Client['job_ns'] = $job->ns;
+ $job4Client['job_set_id'] = $job->job_set_id;

- $tTitle = Title::newFromText($job->title,
$job->ns);
+ $tTitle = Title::newFromText($job->title, $job->ns);

- $job4Client['job_fullTitle'] =
$tTitle->getFullText();
+ $job4Client['job_fullTitle'] = $tTitle->getFullText();

- //@@todo avoid an api round trip return url
here:
- //$job4Client['job_url'] = $file->getFullURL();
+ //@@todo avoid an api round trip return url here:
+ //$job4Client['job_url'] = $file->getFullURL();

- $this->getResult()->addValue( null,
$this->getModuleName(),
- array(
- 'job' => $job4Client
- )
- );
+ $this->getResult()->addValue(
+ null,
+ $this->getModuleName(),
+ array(
+ 'job' => $job4Client
+ )
+ );
+ }
+ }
+ /*
+ * proccess the job key:
+ */
+ function doProccessJobKey( $job_key ){
+ global $wgRequest, $wgUser;
+ //check if its a valid job key (job_number _ sh1(job_json) )
+ list($job_id, $json_sha1) = explode( '_', $job_key );
+
+ //get the job object
+ $job = WahJobManager::getJobById( $job_id );
+
+ if( !$job || sha1($job->job_json) != $json_sha1){
+ //die on bad job key
+ return $this->dieUsageMsg( array( 'code' =>
'badjobkey', 'info'=>'Bad Job key' ) );
+ }
+
+ $jobSet = WahJobManager::getJobSetById( $job->job_set_id );
+ //check if its a valid video ogg file (ffmpeg2theora --info)
+ $uploadedJobFile = $wgRequest->getFileTempname('file');
+ $mediaMeta = wahGetMediaJsonMeta( $uploadedJobFile );
+
+ if( !$mediaMeta ){
+ //failed basic ffmpeg2theora video validation
+ return $this->dieUsageMsg( array( 'code'=>'badfile',
'info'=>"Not a valid Video file") );
+ }
+
+ //gab the ogg types from OggHandler.php
+ global $wgOggVideoTypes, $wgOggAudioTypes;
+ //check for theora and vorbis streams in the metadata output of
the file:
+ if( isset($wgOggVideoTypes) && isset($wgOggAudioTypes) ){
+ $isOgg = false;
+
+ foreach ( $mediaMeta->video as $videoStream ) {
+ if(in_array( ucfirst( $videoStream->codec ),
$wgOggVideoTypes))
+ $isOgg =true;
}
- }else if ( $this->mParams['jobkey'] ){
- print "have jobKey: " . $this->mParams['jobkey'] ;
- //process the upload
- //check if its a valid job key (job_number _
sh1(job_json) )
- list($job_id, $json_sha1) = explode( '_',
$this->mParams['jobkey'] );
- $job = WahJobManager::getJobById( $job_id );
- if( !$job || sha1($job->job_json) != $json_sha1){
- //die on bad job key
- return $this->dieUsage('Your job key is not
valid', 'badjobkey' );
+ foreach ( $mediaMeta->audio as $audioStream ) {
+ if(in_array( ucfirst( $audioStream->codec ),
$wgOggAudioTypes))
+ $isOgg = true;
}
- $jobSet = WahJobManager::getJobSetById(
$job->job_set_id );
- //check if its a valid video ogg file (ffmpeg2theora
--info)
- $uploadedJobFile = $this->getFileTempname('file');
- $mediaMeta = wahGetMediaJsonMeta( $uploadedJobFile );
-
- if( !$mediaMeta ){
- //failed basic ffmpeg2theora video validation
- return $this->dieUsage('Not a valid Video
File', 'badfile' );
+ if(!$isOgg){
+ return $this->dieUsageMsg(
array('code'=>'badfile', 'info'=>'Not a valid Ogg file') );
}
- //check for theora and vorbis streams in the metadata
output of the file:
- if( class_exists( OggHandler ) ){
- $isOgg = false;
+ }
+
+ //all good so far put it into the derivative temp folder by
with each piece as it job_id name
+ //@@todo need to rework this a bit for flattening "sequences"
+ $fTitle = Title::newFromText( $jobSet->set_title,
$jobSet->set_namespace );
+ $file = RepoGroup::singleton()->getLocalRepo()->newFile(
$fTitle );
+ $thumbPath = $file->getThumbPath( $jobSet->set_encodekey );

- if( OggHandler::audioTypes ){
- $audioTypes = OggHandler::audioTypes;
+ $destTarget = $thumbPath . '/'. $job->job_order_id . '.ogg';
+ if( is_file($destTarget) ){
+ //someone else beat this user to finish the job (with a
$wgJobTimeOut handicap )
+ return $this->dieUsageMsg( array(
'code'=>'alreadydone', 'info'=>'The job has already been completed') );
+ }
+ //move the current chunk to that path:
+ $status = RepoGroup::singleton()->getLocalRepo()->store(
+ $uploadedJobFile,
+ 'thumb',
+ $destTarget
+ );
+ if( !$status->isGood() ){
+ return $this->dieUsageMsg( array('code'=>'fileerror',
'info'=>'Could Not Move The Uploaded File') );
+ }
+ $dbw = &wfGetDb( DB_READ );
+ //update the jobqueue table with job done time & user
+ $dbw->update('wah_jobqueue',
+ array(
+ 'job_done_user_id' => $wgUser->getId(),
+ 'job_done_time' => time()
+ ),
+ array(
+ 'job_id' => $job_id
+ ),
+ __METHOD__,
+ array(
+ 'LIMIT' => 1
+ )
+ );
+
+ // reduce job_client_count by 1 now that this client is "done"
+ $dbw->update('wah_jobset',
+ array(
+ 'set_client_count = set_client_count -1'
+ ),
+ array(
+ 'set_id' => $jobSet->set_id
+ ),
+ __METHOD__,
+ array(
+ 'LIMIT' => 1
+ )
+ );
+ //check if its the "last" job shell out a join command
+ $wjm = WahJobManager::newFromSet( $jobSet );
+ $percDone = $wjm->getDonePerc();
+ if($percDone != 1){
+ //the stream is not done but success
+ return $this->getResult()->addValue( null,
$this->getModuleName(),
+ array(
+ 'chunkaccepted' => true,
+ 'setdone' => false
+ )
+ );
+ }else if( $percDone == 1){
+ //all the files are "done" according to the DB:
+ //make sure all the files exist in the
+ $fileList = '';
+ for( $i=0; $i < $jobSet->set_jobs_count ; $i++ ){
+ //make sure all the files are present:
+ if(!is_file($thumbPath . $i . '.ogg' )){
+ wfDebug('Missing wikiAtHome chunk $i');
+ //unset the job complete state
+ $dbw->update( 'wah_jobqueue',
+ array(
+ 'job_done_time = NULL',
+ 'job_done_user_id =
NULL'
+ ),
+ array(
+ 'job_set_id' =>
$jobSet->set_id,
+ 'job_order_id' => $i
+ ),
+ __METHOD__,
+ array(
+ 'LIMIT' => 1
+ )

+ );
+ //return missing files (maybe something
is ~broken~)
+ return $this->dieUsageMsg( array(
+ 'code'=>'missingfile',
+ 'info'=>"WikiAtHome database
out of sync with file system missing file $i"
+ )
+ );

}
- foreach ( $mediaMeta['video'] as $videoStream )
{
- if(in_array( ucfirst(
$videoStream->codec ), OggHandler::videoTypes))
- $isOgg =true;
- }
- foreach ( $mediaMeta['audio'] as $audioStream )
{
- if(in_array( ucfirst(
$audioStream->codec ), OggHandler::audioTypes))
- $isOgg = true;
- }
- if(!$isOgg){
- return $this->dieUsage('Not a valid Ogg
file', 'badfile' );
- }
+ $fileList+= " {$thumbPath}/{$i}.ogg";
}
- //all good so far put it into the derivative temp
folder by with each piece as it job_id name
- //@@todo need to rework this a bit for flattening
"sequences"
- $fTitle = Title::newFromText( $jobSet->set_title,
$jobSet->set_namespace );
- $file =
RepoGroup::singleton()->getLocalRepo()->newFile( $fTitle );
- $thumbPath = $file->getThumbPath(
$jobSet->set_encodekey );
+ //do merge request (not sure if we need to shell out
for this or if we can do it in place)
+ //should be disk speed limited:
+ global $wgOggCat;
+ $finalDestTarget = "{$thumbPath}.ogg";
+ $cmd = wfEscapeShellArg( $wgOggCat ) . ' '
.$finalDestTarget . ' ' . wfEscapeShellArg ( $fileList );
+ wfProfileIn( 'oggCat' );
+ wfShellExec( $cmd );
+ wfProfileOut( 'oggCat' );

- $destTarget = $job_id . '.ogg';
+ //the stream done but success
+ return $this->getResult()->addValue( null,
$this->getModuleName(),
+ array(
+ 'chunkaccepted' => true,
+ 'setdone' => true,
+ )
+ );
+ }

- //copy the current chunk to that path:
- $status = RepoGroup::singleton()->getLocalRepo()->store(
- $uploadedJobFile,
- 'thumb',
- $destTarget
- );
- if( !$status->isGood() ){
- return $this->dieUsage( 'Could not Copy File');
- }
- return $this->dieUsage('copied file to: ' .
$destTarget);
-
- //update the table with job done time & job user
-
-
- //check if its the "last" job shell out a join command
-
- //double check all the files exist.
-
- //return success
-
- }
+ //return success
+
}
public function getAllowedParams() {
return array(

Modified: trunk/extensions/WikiAtHome/NonFreeVideoHandler.php
===================================================================
--- trunk/extensions/WikiAtHome/NonFreeVideoHandler.php 2009-07-31 08:52:31 UTC
(rev 54078)
+++ trunk/extensions/WikiAtHome/NonFreeVideoHandler.php 2009-07-31 09:30:02 UTC
(rev 54079)
@@ -143,10 +143,10 @@
//see if we have that encoding profile already:

//get the job manager .. check status and output current state
or defer to oggHanndler_body for output
- $jobSet = new WahJobManager( $file , $encodeKey );
- $percDone = $jobSet->getDonePerc();
+ $wjm = WahJobManager::newFromFile( $file , $encodeKey );
+ $percDone = $wjm->getDonePerc();
if( $percDone == 1 ){
- //we should be able to output ogg then:
+ //we should use oggHandler to output ogg
}else{
//output our current progress
return new MediaQueueTransformOutput($file, $width,
$height, $percDone );
@@ -294,7 +294,7 @@

function toHtml( $options = array() ) {
wfLoadExtensionMessages( 'WikiAtHome' );
- $waitHtml = wfMsgWikiHtml( 'wah-transcode-working',
$this->percDone ) . "<br>" .
+ $waitHtml = time() . wfMsgWikiHtml( 'wah-transcode-working',
$this->percDone ) . "<br>" .
wfMsgWikiHtml('wah-transcode-helpout');

//@@this is just a placeholder we should desing a waiting for
transcode thing

Modified: trunk/extensions/WikiAtHome/README
===================================================================
--- trunk/extensions/WikiAtHome/README 2009-07-31 08:52:31 UTC (rev 54078)
+++ trunk/extensions/WikiAtHome/README 2009-07-31 09:30:02 UTC (rev 54079)
@@ -5,5 +5,11 @@
require( "$IP/extensions/WikiAtHome/WikiAtHome.php" );

You will also need to install ffmpeg2theora (for getting info about files)
-you can download the latest here:
+you should get the latest that supports the --info argument:
http://firefogg.org/nightly/
+
+You will also need oggCat also available here:
+http://firefogg.org/nightly/
+
+And don't forget to add the mysql tables:
+WikiAtHome.sql

Modified: trunk/extensions/WikiAtHome/SpecialWikiAtHome.php
===================================================================
--- trunk/extensions/WikiAtHome/SpecialWikiAtHome.php 2009-07-31 08:52:31 UTC
(rev 54078)
+++ trunk/extensions/WikiAtHome/SpecialWikiAtHome.php 2009-07-31 09:30:02 UTC
(rev 54079)
@@ -13,7 +13,7 @@
}
function execute( $par ) {
global $wgOut;
- $wgOut->addScriptClass('WikiAtHome');
+ $wgOut->addScriptClass('WikiAtHome');
//for now just render out wiki@home header
$html = '<h1 class="firstHeading"
id="firstHeading">'.wfMsg('specialwikiathome').'</h1>';
$html.='<div id="bodyContent">';

Modified: trunk/extensions/WikiAtHome/WahJobManager.php
===================================================================
--- trunk/extensions/WikiAtHome/WahJobManager.php 2009-07-31 08:52:31 UTC
(rev 54078)
+++ trunk/extensions/WikiAtHome/WahJobManager.php 2009-07-31 09:30:02 UTC
(rev 54079)
@@ -2,12 +2,24 @@
class WahJobManager {
//encoding profiles (settings set in config)

- function __construct(&$file, $encodeKey){
- $this->file = $file;
- $this->sEncodeKey = $encodeKey;
- $this->sNamespace =$this->file->title->getNamespace();
- $this->sTitle = $this->file->title->getDBkey();
+ function __construct(){
}
+
+ function newFromFile(&$file, $encodeKey){
+ $wjm = new WahJobManager();
+ $wjm->file = $file;
+ $wjm->sEncodeKey = $encodeKey;
+ $wjm->sNamespace = $wjm->file->title->getNamespace();
+ $wjm->sTitle = $wjm->file->title->getDBkey();
+ return $wjm;
+ }
+ function newFromSet( $jobSet ){
+ $wjm = new WahJobManager();
+ $this->sNamespace = $jobSet->set_namespace;
+ $this->sTitle = $jobSet->set_title;
+ $this->sEncodeKey = $jobSet->set_encodekey;
+ return $wjm;
+ }

/*
* get the percentage done (return 1 if done)
@@ -91,11 +103,11 @@
$job = $dbr->selectRow( 'wah_jobqueue',
'*',
array(
- 'job_last_assigned_user_id' => $wgUser->getId()
+ 'job_last_assigned_user_id' => $wgUser->getId(),
+ 'job_done_time is NULL'
),
__METHOD__
);
-
//re-assign the same job (don't update anything so it can
timeout if they keep getting the same job)
if( $job ){
return WahJobManager::assignJob( $job , false, false);
@@ -110,7 +122,7 @@
),
__METHOD__
);
- if( $jobSet ){
+ if( !$jobSet ){
//no jobs:
return false;
}else{
@@ -125,7 +137,7 @@
$dbr->addQuotes(
time() - $wgJobTimeOut )
),
__METHOD__
- );
+ );
if( !$job ){
//no jobs in this jobset (return nojob)
//@@todo we could "retry" since we will get
here when a set has everything assigned in less than $wgJobTimeOut
@@ -200,9 +212,9 @@
}
static function getJobById( $job_id ){
$dbr = wfGetDb( DB_READ );
- return $dbr->selectRow('wah_jobset', '*',
+ return $dbr->selectRow('wah_jobqueue', '*',
array(
- 'job_id' => $set_id
+ 'job_id' => $job_id
),
__METHOD__
);
@@ -240,8 +252,7 @@
$encSettingsAry['endtime'] =
$encSettingsAry['starttime'] + $wgChunkDuration;

$jobJsonAry = array(
- 'jobType' => 'transcode',
- 'chunkNumber' => $i,
+ 'jobType' => 'transcode',

'encodeSettings'=> $encSettingsAry
);

@@ -249,6 +260,7 @@
$jobInsertArray[] =
array(
'job_set_id' => $this->sId,
+ 'job_order_id' => $i,
'job_json' =>
ApiFormatJson::getJsonEncode( $jobJsonAry )
);
}

Modified: trunk/extensions/WikiAtHome/WikiAtHome.js
===================================================================
--- trunk/extensions/WikiAtHome/WikiAtHome.js 2009-07-31 08:52:31 UTC (rev
54078)
+++ trunk/extensions/WikiAtHome/WikiAtHome.js 2009-07-31 09:30:02 UTC (rev
54079)
@@ -12,7 +12,7 @@
"wah-start-on-visit": "Start up Wiki@Home anytime I visit this site",
"wah-jobs-while-away": "Only run jobs when I have been away from my
browser for 20 minnutes",

- "wah-nojobfound" : "No Job Found, Will retry in $1 seconds",
+ "wah-nojobfound" : "No Job Found, Will retry in $1",

"wah-notoken-login" : "Could not get a token. Are you logged in?",
"wah-apioff" : "The api appears to be off. Please Contact
your Wiki Admin",
@@ -20,6 +20,9 @@
"wah-doing-job" : "Job: <i>$1</i> on: <i>$2</i>",
"wah-downloading" : "Downloading File <i>$1%</i> done",
"wah-encoding" : "Encoding File <i>$1%</i> done",
+
+ "wah-encoding-fail" : "Encoding Failed. Please reload this page or
try back latter.",
+
"wah-uploading" : "Uploading File <i>$i</i> done",
"wah-uploadfail" : "Uploading Failed",
"wah-doneuploading" : "Done Uploading. Thanks for your Contribution.",
@@ -32,7 +35,7 @@
wahConfig = {
'wah_container' : '#wah_container',
//how many seconds to wait before looking for a job again (in seconds)
- 'jobsearch_delay' : 90
+ 'jobsearch_delay' : ( wgClientSearchInterval ) ?
wgClientSearchInterval: 60
};

//js2AddOnloadHook ensures that the dom and core libraries are ready:
@@ -244,7 +247,9 @@
}
//have firefogg download the file:
js_log("do selectVideoUrl:: " + _this.source_url);
- _this.fogg.selectVideoUrl( _this.source_url );
+ _this.fogg.selectVideoUrl( _this.source_url );

+
+
//check firefogg state and update status:
var updateDownloadState = function(){

if( _this.fogg.state == 'downloading'){
@@ -253,9 +258,9 @@
//loop update:

setTimeout(updateDownloadState, 100);
}else if( _this.fogg.state == 'downloaded'){
- js_log('downloaded is done, run
encode');
+ js_log('downloaded is done, run
encode:' + JSON.stringify( job.job_json.encodeSettings ) );
//we can now issue the encode
call
- _this.fogg.encode(
+ _this.fogg.encode(
JSON.stringify(

job.job_json.encodeSettings
)
@@ -265,6 +270,7 @@
js_log('download state failed');
}

}
+
//do the initial call to downloading state updates
if( _this.fogg.state == 'downloading'){
setTimeout(updateDownloadState, 100);
@@ -284,16 +290,40 @@
})
);
//do upload req
- updateUploadState();
+ updateUploadState();
return true;
+ }else if( _this.fogg.state == 'encoding
failed'){
+ js_log('encoding failed');
+ //maybe its time to refresh the window?
+ $j('#tab-jobs .prograss-status').html(
+ gM( 'wah-encoding-fail' )
+ );
+ return false;
}
setTimeout(updateEncodeState, 100);

}
//our updateUploadState update
- var updateUploadState = function(){

+ var updateUploadState = function(){

_this.updateProgress( _this.fogg.progress(),
'wah-uploading');
if( _this.fogg.state == 'upload done'){
- //done uploading
+ //get the json result:
+ var response_text =
_this.fogg.responseText;
+ if(!response_text){
+ try{
+ var pstatus =
JSON.parse( _this.fogg.uploadstatus() );
+ response_text =
pstatus["responseText"];
+ }catch(e){
+ js_log("could not
parse uploadstatus / could not get responseText");
+ }
+ }
+ //see if we can parse the result
+ try{
+ resultObj = JSON.parse(
response_text );
+ }catch(e){
+ js_log("could not parse result
of upload ");
+ }
+
+
//congradulate the user and issue new
job request
$j('#tab-jobs .prograss-status').html(
gM( 'wah-doneuploading' )
@@ -302,7 +332,7 @@
_this.lookForJob(
job.job_set_id );
}
//display the msg for 3 seconds
- //setTimeout(getNextTranscodeJob, 3000);
+ setTimeout(getNextTranscodeJob, 3000);

return true;

}else if( _this.fogg.state == 'uplaod failed'){
@@ -320,7 +350,7 @@
},
updateProgress: function(perc, msgKey){
//get percent done with 2 decimals
- var percDone = Math.round(perc * 10000) /100;
+ var percDone = (perc == 0 ) ? '0': Math.round(perc * 10000)
/100;
//update progress bar
$j('#tab-jobs .progress-bar').progressbar(
'value',

Modified: trunk/extensions/WikiAtHome/WikiAtHome.php
===================================================================
--- trunk/extensions/WikiAtHome/WikiAtHome.php 2009-07-31 08:52:31 UTC (rev
54078)
+++ trunk/extensions/WikiAtHome/WikiAtHome.php 2009-07-31 09:30:02 UTC (rev
54079)
@@ -36,6 +36,18 @@
//add api module for processing jobs
$wgAPIModules['wikiathome'] = 'ApiWikiAtHome';

+function wahAddGlobalPageVars(&$vars){
+ global $wgClientSearchInterval, $wgTitle;
+ //only add to the special page:
+ if($vars['wgCanonicalSpecialPageName'] == 'SpecialWikiAtHome'){
+ $vars['wgClientSearchInterval'] = $wgClientSearchInterval;
+ }
+ return true;
+}
+//hooks
+$wgHooks['MakeGlobalVariablesScript'][] = 'wahAddGlobalPageVars';
+
+
//credits
$wgExtensionCredits['media'][] = array(
'path' => __FILE__,
@@ -62,20 +74,19 @@
* gets the json metadata from a given file (also validates it as a valid file)
*/
function wahGetMediaJsonMeta( $path ){
+ global $wgffmpeg2theora;
+
$cmd = wfEscapeShellArg( $wgffmpeg2theora ) . ' ' . wfEscapeShellArg (
$path ). ' --info';
- wfProfileIn( 'ffmpeg2theora shellExec' );
- wfDebug( __METHOD__.": $cmd\n" );
- $json_meta_str = wfShellExec( $cmd );
- wfProfileOut( 'ffmpeg2theora shellExec' );
+ wfProfileIn( 'ffmpeg2theora' );
+ $json_meta_str = wfShellExec( $cmd );
+ wfProfileOut( 'ffmpeg2theora' );
$objMeta = json_decode( $json_meta_str );
-
//if we return the same string then json_decode has failed in php <
5.2.6
//workaround for bug http://bugs.php.net/bug.php?id=45989
if( $objMeta == $json_meta_str )
return false;
return $objMeta;
}
-
/******************* CONFIGURATION STARTS HERE **********************/

//ffmpeg2theora path: enables us to get basic source file information
@@ -84,13 +95,16 @@
//the oggCat path enables server side concatenation of encoded "chunks"
$wgOggCat = '/usr/bin/oggCat';

-//if you do have oggCat installed then we can do encoding jobs in "chunks"
+//with oggCat installed then we can do encoding jobs in "chunks"
//and assemble on the server: (this way no single slow client slows down
//a video job and we can have tighter timeouts)
// $wgChunkDuration is set in seconds: (setting this too low will result in
bad encodes)
// $wgChunkDuration is only used if we have a valid $wgOggCat install
-$wgChunkDuration = '10';
+$wgChunkDuration = '30';

+//time interval in seconds between clients asking the server for jobs.
+$wgClientSearchInterval = 90;
+
//how long before considering a job ready to be assigned to others
//note first "in" wins & if once time is up we decrement set_c
$wgJobTimeOut = 60*10; //10 min



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@xxxxxxxxxxxxxxxxxxx
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise