r47237 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47236‎ | r47237 | r47238 >
Date:23:21, 13 February 2009
Author:dale
Status:deferred
Tags:
Comment:
* archive.org remote archive search stubs
* basic sound mime type support
* remove old not used icons
Modified paths:
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/searchLibs/mediaWikiSearch.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/searchLibs/solrArchiveSearch.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/images/sound_music_icon-60.png (added) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/images/sound_music_icon.png (added) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/remote_search (deleted) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/searchLibs/solrArchiveSearch.js
@@ -24,10 +24,14 @@
2525 var _this = this;
2626 this.loading=true;
2727 js_log('f:getSearchResults for:' + $j('#rsd_q').val() );
28 - //build the req:
 28+ //build the query var
 29+ var q = $j('#rsd_q').val();
 30+ //@@todo check advanced options:
 31+ q+=' format:(Ogg video)';
 32+ q+=' licenseurl:(http\\:\\/\\/creativecommons\\.org*)';
2933 var reqObj = {
30 - 'q':$j('#rsd_q').val() + ' format:(Ogg video)', //just search for video atm
31 - 'fl':"description,identifier,licenseurl,format,license,thumbnail",
 34+ 'q': q, //just search for video atm
 35+ 'fl':"description,title,identifier,licenseurl,format,license,thumbnail",
3236 'wt':'json',
3337 'rows':'30',
3438 'indent':'yes'
@@ -37,8 +41,41 @@
3842 'url':this.cp.api_url,
3943 'jsonCB':'json.wrf'
4044 }, function(data){
41 - js_log('got data: ' + data);
 45+ _this.addResults( data);
 46+ _this.loading = false;
4247 }
43 - });
44 - }
 48+ );
 49+ },
 50+ addResults:function( data ){
 51+ var _this = this;
 52+ if(data.response && data.response.docs){
 53+ for(var resource_id in data.response.docs){
 54+ var resource = data.response.docs[resource_id];
 55+ //make sure the reop is shared
 56+ rObj = {
 57+ 'titleKey' :resource.identifier,
 58+ 'link' :'http://www.archive.org/details/' + resource.identifier,
 59+ 'title' :resource.title
 60+ };
 61+ rObj['poster']='http://www.archive.org/download/'+resource.identifier+'/format=thumbnail';
 62+ rObj['thumbwidth']=160;
 63+ rObj['thumbheight']=110;
 64+ rObj['src']='http://www.archive.org/download/'+ +resource.identifier+'/format=Ogg+video';
 65+ rObj['mime']='application/ogg';
 66+ rObj['pSobj']=_this;
 67+ this.resultsObj[resource_id] =rObj;
 68+
 69+ //likely a audio clip if no poster and type application/ogg
 70+ //@@todo we should return audio/ogg for the mime type or some other way to specify its "audio"
 71+
 72+ //this.num_results++;
 73+ //for(var i in this.resultsObj[page_id]){
 74+ // js_log('added: '+ i +' '+ this.resultsObj[page_id][i]);
 75+ //}
 76+ }
 77+ }
 78+ },
 79+ getEmbedHTML: function( rObj , options) {
 80+ //alert('archive.org support not yet ready');
 81+ },
4582 }
\ No newline at end of file
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/searchLibs/mediaWikiSearch.js
@@ -76,26 +76,33 @@
7777 //skip page is redirect
7878 continue;
7979 }
80 - //skip if its an empy or missing imageinfo:
81 - if(!page.imageinfo)
 80+ //skip if its an empty or missing imageinfo:
 81+ if( !page.imageinfo )
8282 continue;
8383
8484 this.resultsObj[page_id]={
85 - 'titleKey' : page.title,
86 - 'link' :page.imageinfo[0].descriptionurl,
87 - 'title' :page.title.replace(/File:|.jpg|.png|.svg|.ogg|.ogv/ig, ''),
88 - 'poster' :page.imageinfo[0].thumburl,
89 - 'thumbwidth':page.imageinfo[0].thumbwidth,
 85+ 'titleKey' : page.title,
 86+ 'link' :page.imageinfo[0].descriptionurl,
 87+ 'title' :page.title.replace(/File:|.jpg|.png|.svg|.ogg|.ogv|.oga/ig, ''),
 88+ 'poster' :page.imageinfo[0].thumburl,
 89+ 'thumbwidth' :page.imageinfo[0].thumbwidth,
9090 'thumbheight':page.imageinfo[0].thumbheight,
91 - 'mime' :page.imageinfo[0].mime,
92 - 'src' :page.imageinfo[0].url,
93 - 'desc' :page.revisions[0]['*'],
 91+ 'mime' :page.imageinfo[0].mime,
 92+ 'src' :page.imageinfo[0].url,
 93+ 'desc' :page.revisions[0]['*'],
9494 //add pointer to parent search obj:
95 - 'pSobj' :_this,
 95+ 'pSobj' :_this,
9696 'meta':{
9797 'categories':page.categories
9898 }
9999 }
 100+
 101+ //likely a audio clip if no poster and type application/ogg
 102+ //@@todo we should return audio/ogg for the mime type or some other way to specify its "audio"
 103+ if( ! this.resultsObj[page_id].poster && this.resultsObj[page_id].mime == 'application/ogg' ){
 104+ this.resultsObj[page_id].mime = 'audio/ogg';
 105+ }
 106+
100107 this.num_results++;
101108 //for(var i in this.resultsObj[page_id]){
102109 // js_log('added: '+ i +' '+ this.resultsObj[page_id][i]);
@@ -165,7 +172,7 @@
166173 if( options['max_height'] ){
167174 outOpt.height = (options.max_height > rObj.height) ? rObj.height : options.max_height;
168175 outOpt.width = (rObj.width / rObj.height) *outOpt.height;
169 - }
 176+ }
170177 var style_attr = 'style="width:' + outOpt.width + 'px;height:' + outOpt.height +'px"';
171178 var id_attr = (options['id'])?' id = "' + options['id'] +'" ': '';
172179
@@ -173,12 +180,19 @@
174181 if(rObj.mime.indexOf('image')!=-1){
175182 return '<img ' + id_attr + ' src="' + rObj.url + '"' + style_attr + ' >';
176183 }
177 - if(rObj.mime.indexOf('application/ogg')!=-1){
178 - return '<video ' + id_attr +
 184+ var ahtml='';
 185+ if(rObj.mime == 'application/ogg' || rObj.mime == 'audio/ogg'){
 186+ ahtml = id_attr +
179187 ' src="' + rObj.src + '" ' +
180188 style_attr +
181 - ' poster="'+ rObj.poster + '" '+
182 - ' ></video>';
 189+ ' poster="'+ rObj.poster + '" '
 190+ if(rObj.mime.indexOf('application/ogg')!=-1){
 191+ return '<video ' + ahtml + '></video>';
 192+ }
 193+
 194+ if(rObj.mime.indexOf('audio/ogg')!=-1){
 195+ return '<audio ' + ahtml + '></audio>';
 196+ }
183197 }
184198 js_log('ERROR:unsupored mime type: ' + rObj.mime);
185199 },
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/remoteSearchDriver.js
@@ -129,7 +129,7 @@
130130 'desc' : 'The Internet Archive, a digital library of cultural artifacts',
131131 'homepage':'http://archive.org',
132132
133 - 'api_url':'http://metavid.org/w/index.php?title=Special:MvExportSearch',
 133+ 'api_url':'http://homeserver7.us.archive.org:8983/solr/select',
134134 'lib' : 'solrArchive',
135135 'local' : false,
136136 'resource_prefix': 'AO_',
@@ -328,14 +328,14 @@
329329 continue;
330330
331331 //set display if unset
332 - if(!this.disp_item)
 332+ if( !this.disp_item )
333333 this.disp_item = cp_id;
334334
335335 //check if we need to update:
336 - if(typeof cp.sObj != 'undefined'){
 336+ if( typeof cp.sObj != 'undefined' ){
337337 if(cp.sObj.last_query == $j('#rsd_q').val() && cp.sObj.last_offset == cp.offset)
338338 continue;
339 - }
 339+ }
340340 //make sure the search library is loaded and do the search:
341341 this.getLibSearchResults( cp );
342342 }
@@ -370,10 +370,10 @@
371371 }
372372 }
373373
374 - if(loading_done){
 374+ if( loading_done ){
375375 this.drawOutputResults();
376376 }else{
377 - setTimeout( _this.instance_name + '.checkResultsDone()', 250);
 377+ setTimeout( _this.instance_name + '.checkResultsDone()', 30);
378378 }
379379 },
380380 drawTabs: function(){
@@ -457,7 +457,7 @@
458458 _this.setResultBarControl();
459459
460460 //output all the results (hide based on tab selection)
461 - for(var cp_id in this.content_providers){
 461+ for( var cp_id in this.content_providers ){
462462 cp = this.content_providers[ cp_id ];
463463 //output results based on display mode & input:
464464 if(typeof cp['sObj'] != 'undefined'){
@@ -466,15 +466,20 @@
467467 if( _this.result_display_mode == 'box' ){
468468 o+='<div id="mv_result_' + rInx + '" class="mv_clip_box_result" style="' + disp + 'width:' +
469469 _this.thumb_width + 'px;height:'+ (_this.thumb_width-20) +'px;position:relative;">';
 470+ //check for missing poster types for audio
 471+ if( rItem.mime=='audio/ogg' && !rItem.poster ){
 472+ rItem.poster = mv_embed_path + 'skins/' + mv_skin_name + '/images/sound_music_icon-80.png';
 473+ }
470474 o+='<img title="'+rItem.title+'" class="rsd_res_item" id="res_' + rInx +'" style="width:' + _this.thumb_width + 'px;" src="' + rItem.poster + '">';
471475 //add a linkback to resource page in upper right:
472 - if(rItem.link)
 476+ if( rItem.link )
473477 o+='<a target="_new" style="position:absolute;top:0px;right:0px" title="' + gM('Resource Description Page') +
474478 '" href="' + rItem.link + '"><img src="' + stylepath + '/common/images/magnify-clip.png"></a>';
475479 o+='</div>';
476480 }else if(_this.result_display_mode == 'list'){
477481 o+='<div id="mv_result_' + rInx + '" class="mv_clip_list_result" style="' + disp + 'width:90%">';
478 - o+='<img title="'+rItem.title+'" class="rsd_res_item" id="res_' + rInx +'" style="float:left;width:' + _this.thumb_width + 'px; padding:5px;" src="' + rItem.poster + '">';
 482+ o+='<img title="'+rItem.title+'" class="rsd_res_item" id="res_' + rInx +'" style="float:left;width:' +
 483+ _this.thumb_width + 'px; padding:5px;" src="' + rItem.poster + '">';
479484 o+= rItem.desc ;
480485 o+='<div style="clear:both" />';
481486 o+='</div>';
@@ -512,6 +517,9 @@
513518 //set width to default image_edit_width
514519 var maxWidth = _this.image_edit_width;
515520 var mediaType = 'image';
 521+ }else if(rObj.mime.indexOf('audio')!=-1){
 522+ var maxWidth = _this.video_edit_width;
 523+ var mediaType = 'audio';
516524 }else{
517525 //set to default video size:
518526 var maxWidth = _this.video_edit_width;
@@ -545,7 +553,8 @@
546554 'top':'40%',
547555 'left':'20%',
548556 'opacity':0
549 - });
 557+ });
 558+
550559
551560 //assume we keep aspect ratio for the thumbnail that we clicked:
552561 var tRatio = $j(rsdElement).height() / $j(rsdElement).width();
@@ -634,10 +643,10 @@
635644 _this.cEdit = new mvClipEdit( mvClipInit );
636645 });
637646 }
638 - if( mediaType == 'video'){
 647+ if( mediaType == 'video' || mediaType == 'audio'){
639648 js_log('append html: ' + rObj.pSobj.getEmbedHTML( rObj, {id:'embed_vid'}) );
640649 $j('#clip_edit_disp').append(
641 - rObj.pSobj.getEmbedHTML( rObj, {id:'embed_vid'})
 650+ rObj.pSobj.getEmbedHTML( rObj, {id:'embed_vid'})
642651 );
643652 //rewrite by id handldes getting any libs we are missing:
644653 rewrite_by_id('embed_vid',function(){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/images/sound_music_icon-60.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/images/sound_music_icon-60.png
___________________________________________________________________
Name: svn:mime-type
645654 + application/octet-stream
Index: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/images/sound_music_icon.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/images/sound_music_icon.png
___________________________________________________________________
Name: svn:mime-type
646655 + application/octet-stream
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -22,7 +22,7 @@
2323 }
2424
2525 //used to grab fresh copies of scripts. (should be changed on commit)
26 -var MV_EMBED_VERSION = '1.0r9';
 26+var MV_EMBED_VERSION = '1.0r10';
2727
2828 //the name of the player skin (default is mvpcf)
2929 var mv_skin_name = 'mvpcf';
@@ -801,7 +801,7 @@
802802
803803 var loadPlaylistLib=false;
804804 //set up the jQuery selector:
805 - var j_selector = 'video,playlist';
 805+ var j_selector = 'video,audio,playlist';
806806 if( force_id !=null )
807807 var j_selector = '#'+force_id;
808808
@@ -822,15 +822,20 @@
823823 */
824824
825825 //if video doSwap
826 - if( this.tagName.toLowerCase() == 'video'){
827 - var videoInterface = new embedVideo(this);
828 - swapEmbedVideoElement( this, videoInterface );
829 - }else{
830 - js_log( this.tagName.toLowerCase()+ ' != video' );
831 - }
832 - //if playlist set do load playlist
833 - if( this.tagName.toLowerCase() == 'playlist' )
834 - loadPlaylistLib=true;
 826+ switch( this.tagName.toLowerCase()){
 827+ case 'video':
 828+ var videoInterface = new embedVideo(this);
 829+ swapEmbedVideoElement( this, videoInterface );
 830+ break;
 831+ case 'audio':
 832+ var videoInterface = new embedVideo(this);
 833+ videoInterface.type ='audio';
 834+ swapEmbedVideoElement( this, videoInterface );
 835+ break;
 836+ case 'playlist':
 837+ loadPlaylistLib=true;
 838+ break;
 839+ }
835840 });
836841 if(loadPlaylistLib){
837842 js_log('f:load Playlist Lib:');
@@ -1055,7 +1060,7 @@
10561061 }
10571062 });
10581063 }else{
1059 - if( typeof options.jsonCB == 'undefiend')
 1064+ if( typeof options.jsonCB == 'undefined')
10601065 options.jsonCB = 'callback';
10611066 var req_url = options.url;
10621067 var paramAnd = (req_url.indexOf('?')==-1)?'?':'&';

Status & tagging log