Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/searchLibs/solrArchiveSearch.js |
— | — | @@ -24,10 +24,14 @@ |
25 | 25 | var _this = this; |
26 | 26 | this.loading=true; |
27 | 27 | 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*)'; |
29 | 33 | 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", |
32 | 36 | 'wt':'json', |
33 | 37 | 'rows':'30', |
34 | 38 | 'indent':'yes' |
— | — | @@ -37,8 +41,41 @@ |
38 | 42 | 'url':this.cp.api_url, |
39 | 43 | 'jsonCB':'json.wrf' |
40 | 44 | }, function(data){ |
41 | | - js_log('got data: ' + data); |
| 45 | + _this.addResults( data); |
| 46 | + _this.loading = false; |
42 | 47 | } |
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 | + }, |
45 | 82 | } |
\ No newline at end of file |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/searchLibs/mediaWikiSearch.js |
— | — | @@ -76,26 +76,33 @@ |
77 | 77 | //skip page is redirect |
78 | 78 | continue; |
79 | 79 | } |
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 ) |
82 | 82 | continue; |
83 | 83 | |
84 | 84 | 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, |
90 | 90 | '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]['*'], |
94 | 94 | //add pointer to parent search obj: |
95 | | - 'pSobj' :_this, |
| 95 | + 'pSobj' :_this, |
96 | 96 | 'meta':{ |
97 | 97 | 'categories':page.categories |
98 | 98 | } |
99 | 99 | } |
| 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 | + |
100 | 107 | this.num_results++; |
101 | 108 | //for(var i in this.resultsObj[page_id]){ |
102 | 109 | // js_log('added: '+ i +' '+ this.resultsObj[page_id][i]); |
— | — | @@ -165,7 +172,7 @@ |
166 | 173 | if( options['max_height'] ){ |
167 | 174 | outOpt.height = (options.max_height > rObj.height) ? rObj.height : options.max_height; |
168 | 175 | outOpt.width = (rObj.width / rObj.height) *outOpt.height; |
169 | | - } |
| 176 | + } |
170 | 177 | var style_attr = 'style="width:' + outOpt.width + 'px;height:' + outOpt.height +'px"'; |
171 | 178 | var id_attr = (options['id'])?' id = "' + options['id'] +'" ': ''; |
172 | 179 | |
— | — | @@ -173,12 +180,19 @@ |
174 | 181 | if(rObj.mime.indexOf('image')!=-1){ |
175 | 182 | return '<img ' + id_attr + ' src="' + rObj.url + '"' + style_attr + ' >'; |
176 | 183 | } |
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 + |
179 | 187 | ' src="' + rObj.src + '" ' + |
180 | 188 | 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 | + } |
183 | 197 | } |
184 | 198 | js_log('ERROR:unsupored mime type: ' + rObj.mime); |
185 | 199 | }, |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -129,7 +129,7 @@ |
130 | 130 | 'desc' : 'The Internet Archive, a digital library of cultural artifacts', |
131 | 131 | 'homepage':'http://archive.org', |
132 | 132 | |
133 | | - 'api_url':'http://metavid.org/w/index.php?title=Special:MvExportSearch', |
| 133 | + 'api_url':'http://homeserver7.us.archive.org:8983/solr/select', |
134 | 134 | 'lib' : 'solrArchive', |
135 | 135 | 'local' : false, |
136 | 136 | 'resource_prefix': 'AO_', |
— | — | @@ -328,14 +328,14 @@ |
329 | 329 | continue; |
330 | 330 | |
331 | 331 | //set display if unset |
332 | | - if(!this.disp_item) |
| 332 | + if( !this.disp_item ) |
333 | 333 | this.disp_item = cp_id; |
334 | 334 | |
335 | 335 | //check if we need to update: |
336 | | - if(typeof cp.sObj != 'undefined'){ |
| 336 | + if( typeof cp.sObj != 'undefined' ){ |
337 | 337 | if(cp.sObj.last_query == $j('#rsd_q').val() && cp.sObj.last_offset == cp.offset) |
338 | 338 | continue; |
339 | | - } |
| 339 | + } |
340 | 340 | //make sure the search library is loaded and do the search: |
341 | 341 | this.getLibSearchResults( cp ); |
342 | 342 | } |
— | — | @@ -370,10 +370,10 @@ |
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
374 | | - if(loading_done){ |
| 374 | + if( loading_done ){ |
375 | 375 | this.drawOutputResults(); |
376 | 376 | }else{ |
377 | | - setTimeout( _this.instance_name + '.checkResultsDone()', 250); |
| 377 | + setTimeout( _this.instance_name + '.checkResultsDone()', 30); |
378 | 378 | } |
379 | 379 | }, |
380 | 380 | drawTabs: function(){ |
— | — | @@ -457,7 +457,7 @@ |
458 | 458 | _this.setResultBarControl(); |
459 | 459 | |
460 | 460 | //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 ){ |
462 | 462 | cp = this.content_providers[ cp_id ]; |
463 | 463 | //output results based on display mode & input: |
464 | 464 | if(typeof cp['sObj'] != 'undefined'){ |
— | — | @@ -466,15 +466,20 @@ |
467 | 467 | if( _this.result_display_mode == 'box' ){ |
468 | 468 | o+='<div id="mv_result_' + rInx + '" class="mv_clip_box_result" style="' + disp + 'width:' + |
469 | 469 | _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 | + } |
470 | 474 | o+='<img title="'+rItem.title+'" class="rsd_res_item" id="res_' + rInx +'" style="width:' + _this.thumb_width + 'px;" src="' + rItem.poster + '">'; |
471 | 475 | //add a linkback to resource page in upper right: |
472 | | - if(rItem.link) |
| 476 | + if( rItem.link ) |
473 | 477 | o+='<a target="_new" style="position:absolute;top:0px;right:0px" title="' + gM('Resource Description Page') + |
474 | 478 | '" href="' + rItem.link + '"><img src="' + stylepath + '/common/images/magnify-clip.png"></a>'; |
475 | 479 | o+='</div>'; |
476 | 480 | }else if(_this.result_display_mode == 'list'){ |
477 | 481 | 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 + '">'; |
479 | 484 | o+= rItem.desc ; |
480 | 485 | o+='<div style="clear:both" />'; |
481 | 486 | o+='</div>'; |
— | — | @@ -512,6 +517,9 @@ |
513 | 518 | //set width to default image_edit_width |
514 | 519 | var maxWidth = _this.image_edit_width; |
515 | 520 | var mediaType = 'image'; |
| 521 | + }else if(rObj.mime.indexOf('audio')!=-1){ |
| 522 | + var maxWidth = _this.video_edit_width; |
| 523 | + var mediaType = 'audio'; |
516 | 524 | }else{ |
517 | 525 | //set to default video size: |
518 | 526 | var maxWidth = _this.video_edit_width; |
— | — | @@ -545,7 +553,8 @@ |
546 | 554 | 'top':'40%', |
547 | 555 | 'left':'20%', |
548 | 556 | 'opacity':0 |
549 | | - }); |
| 557 | + }); |
| 558 | + |
550 | 559 | |
551 | 560 | //assume we keep aspect ratio for the thumbnail that we clicked: |
552 | 561 | var tRatio = $j(rsdElement).height() / $j(rsdElement).width(); |
— | — | @@ -634,10 +643,10 @@ |
635 | 644 | _this.cEdit = new mvClipEdit( mvClipInit ); |
636 | 645 | }); |
637 | 646 | } |
638 | | - if( mediaType == 'video'){ |
| 647 | + if( mediaType == 'video' || mediaType == 'audio'){ |
639 | 648 | js_log('append html: ' + rObj.pSobj.getEmbedHTML( rObj, {id:'embed_vid'}) ); |
640 | 649 | $j('#clip_edit_disp').append( |
641 | | - rObj.pSobj.getEmbedHTML( rObj, {id:'embed_vid'}) |
| 650 | + rObj.pSobj.getEmbedHTML( rObj, {id:'embed_vid'}) |
642 | 651 | ); |
643 | 652 | //rewrite by id handldes getting any libs we are missing: |
644 | 653 | 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 |
645 | 654 | + 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 |
646 | 655 | + application/octet-stream |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | } |
24 | 24 | |
25 | 25 | //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'; |
27 | 27 | |
28 | 28 | //the name of the player skin (default is mvpcf) |
29 | 29 | var mv_skin_name = 'mvpcf'; |
— | — | @@ -801,7 +801,7 @@ |
802 | 802 | |
803 | 803 | var loadPlaylistLib=false; |
804 | 804 | //set up the jQuery selector: |
805 | | - var j_selector = 'video,playlist'; |
| 805 | + var j_selector = 'video,audio,playlist'; |
806 | 806 | if( force_id !=null ) |
807 | 807 | var j_selector = '#'+force_id; |
808 | 808 | |
— | — | @@ -822,15 +822,20 @@ |
823 | 823 | */ |
824 | 824 | |
825 | 825 | //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 | + } |
835 | 840 | }); |
836 | 841 | if(loadPlaylistLib){ |
837 | 842 | js_log('f:load Playlist Lib:'); |
— | — | @@ -1055,7 +1060,7 @@ |
1056 | 1061 | } |
1057 | 1062 | }); |
1058 | 1063 | }else{ |
1059 | | - if( typeof options.jsonCB == 'undefiend') |
| 1064 | + if( typeof options.jsonCB == 'undefined') |
1060 | 1065 | options.jsonCB = 'callback'; |
1061 | 1066 | var req_url = options.url; |
1062 | 1067 | var paramAnd = (req_url.indexOf('?')==-1)?'?':'&'; |