r84074 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84073‎ | r84074 | r84075 >
Date:01:27, 16 March 2011
Author:dale
Status:deferred
Tags:
Comment:
fixed firefogg upload
fixed passthrough selection mode
Modified paths:
  • /branches/uploadwizard-firefogg/resources/mw.FirefoggTransport.js (modified) (history)
  • /branches/uploadwizard-firefogg/resources/mw.UploadWizard.js (modified) (history)

Diff [purge]

Index: branches/uploadwizard-firefogg/resources/mw.FirefoggTransport.js
@@ -33,6 +33,7 @@
3434 }
3535 },
3636 isChunkUpload: function(){
 37+ // for now just test post
3738 return false;
3839 return ( mw.UploadWizard.config[ 'enableFirefoggChunkUpload' ] );
3940 },
@@ -41,9 +42,9 @@
4243 */
4344 isPassThrough: function(){
4445 // Check if the server supports raw webm uploads:
45 - var wembExt = ( $j.inArray( mw.UploadWizard.config[ 'fileExtensions'], 'webm') !== -1 )
 46+ var wembExt = ( $j.inArray( 'webm', mw.UploadWizard.config[ 'fileExtensions'] ) !== -1 )
4647 // Determine passthrough mode
47 - if ( this.isOggFormat() || ( wembExt && isWebMFormat() ) ) {
 48+ if ( this.isOggFormat() || ( wembExt && this.isWebMFormat() ) ) {
4849 // Already Ogg, no need to encode
4950 return true;
5051 } else if ( this.isSourceAudio() || this.isSourceVideo() ) {
@@ -107,20 +108,23 @@
108109 getEncodeExt: function(){
109110 if( this.getEncodeSettings()['videoCodec']
110111 &&
111 - this.getEncodeSettings()['videoCodec'] == 'vp8' )
112 - {
 112+ this.getEncodeSettings()['videoCodec'] == 'vp8' )
 113+ {
113114 return 'webm';
114115 } else {
115116 return 'ogv';
116117 }
117118 },
 119+
118120 /**
119121 * Get the encode settings from configuration and the current selected video type
120122 */
121123 getEncodeSettings: function(){
122 - var encodeSettings = $j.extend( {}, mw.UploadWizard.config[ 'firefoggEncodeSettings'] , {
123 - 'passthrough' : this.isPassThrough()
124 - });
 124+ if( this.isPassThrough() ){
 125+ return { 'passthrough' : true } ;
 126+ }
 127+ // Get the default encode settings:
 128+ var encodeSettings = mw.UploadWizard.config[ 'firefoggEncodeSettings'];
125129 // Update the format:
126130 this.fogg.setFormat( ( this.getEncodeExt == 'webm' )? 'webm' : 'ogg' );
127131
@@ -132,18 +136,12 @@
133137 * Encode then upload
134138 */
135139 doEncodeThenUpload: function(){
136 - // If doing passthrough jump direct to upload:
137 - if( this.isPassThrough() ){
138 - this.doFoggPost();
139 - return ;
140 - }
141140 this.fogg.encode( JSON.stringify( this.getEncodeSettings() ) );
142 -
143141 this.monitorProgress();
144142 },
145143
146144 /**
147 - * do fogg post
 145+ * Do fogg post
148146 */
149147 doFoggPost: function(){
150148 var _this = this;
@@ -159,6 +157,7 @@
160158 _this.monitorProgress();
161159 } );
162160 },
 161+
163162 /**
164163 * Encode and upload in chunks
165164 */
@@ -173,6 +172,7 @@
174173 });
175174 _this.monitorProgress();
176175 },
 176+
177177 /**
178178 * Get the upload url
179179 */
@@ -228,7 +228,7 @@
229229 }
230230 // return the api result:
231231 if( state == 'done' || state == 'upload done' ){
232 - this.transportedCb( this.getResponseText() );
 232+ this.transportedCb( JSON.parse( this.getResponseText() ) );
233233 }
234234
235235 },
Index: branches/uploadwizard-firefogg/resources/mw.UploadWizard.js
@@ -96,10 +96,9 @@
9797 var _this = this;
9898 if ( _this.state == 'aborted' ) {
9999 return ;
100 - }
101 -
 100+ }
102101 if ( result.upload && result.upload.imageinfo ) {
103 - mw.log( 'UploadWizard::setTransported> process api imageinfo' );
 102+ mw.log( 'UploadWizard::setTransported> process api imageinfo' );
104103 // success
105104 _this.state = 'transported';
106105 _this.transportProgress = 1;
@@ -108,7 +107,7 @@
109108
110109 // use blocking preload for thumbnail, no loading spinner.
111110 _this.getThumbnail(
112 - function( image ) {
 111+ function( image ) {
113112 _this.ui.setPreview( image );
114113 _this.deedPreview.setup();
115114 _this.details.populate();
@@ -248,15 +247,16 @@
249248 this.api.get( params, function( data ) {
250249 if ( !data || !data.query || !data.query.stashimageinfo ) {
251250 mw.log("mw.UploadWizardUpload::getThumbnail> No data? ");
252 - // XXX do something about the thumbnail spinner, maybe call the callback with a broken image.
 251+ // XXX do something about the thumbnail spinner, maybe call the callback with a broken image.
253252 return;
254253 }
255254 var thumbnails = data.query.stashimageinfo;
256 - for ( var i = 0; i < thumbnails.length; i++ ) {
 255+ for ( var i = 0; i < thumbnails.length; i++ ) {
257256 var thumb = thumbnails[i];
258257 if ( ! ( thumb.thumburl && thumb.thumbwidth && thumb.thumbheight ) ) {
259258 mw.log( "mw.UploadWizardUpload::getThumbnail> thumbnail missing information" );
260259 // XXX error
 260+ return ;
261261 }
262262 var image = document.createElement( 'img' );
263263 $j( image ).load( function() {

Status & tagging log