1 //archive.org uses solr engine:
2 //more about solr here:
3 //http://lucene.apache.org/solr/
5 var archiveOrgSearch = function ( iObj){
6 return this.init( iObj );
8 archiveOrgSearch.prototype = {
9 //archive.org constants:
10 dnUrl:'http://www.archive.org/download/',
11 dtUrl:'http://www.archive.org/details/',
12 init:function( iObj ){
13 //init base class and inherit:
14 var baseSearch = new baseRemoteSearch( iObj );
15 for(var i in baseSearch){
16 if(typeof this[i] =='undefined'){
17 this[i] = baseSearch[i];
19 this['parent_'+i] = baseSearch[i];
22 //inherit the cp settings for
24 getSearchResults:function(){
26 this.parent_getSearchResults();
30 js_log('f:getSearchResults for:' + $j('#rsd_q').val() );
32 var q = $j('#rsd_q').val();
33 //@@todo check advanced options: include audio and images media types
34 //for now force (Ogg video) & a creativecommons license
35 q+=' format:(Ogg video)';
36 q+=' licenseurl:(http\\:\\/\\/*)';
38 'q': q, //just search for video atm
39 'fl':"description,title,identifier,licenseurl,format,license,thumbnail",
46 'url':this.cp.api_url,
49 _this.addResults( data);
50 _this.loading = false;
54 addResults:function( data ){
56 if(data.response && data.response.docs){
58 this.num_results = data.response.numFound;
60 for(var resource_id in data.response.docs){
61 var resource = data.response.docs[resource_id];
63 //@@todo we should add .ogv or oga if video or audio:
64 'titleKey' : resource.identifier + '.ogg',
65 'resourceKey': resource.identifier,
66 'link' : _this.dtUrl + resource.identifier,
67 'title' : resource.title,
68 'poster' : _this.dnUrl + resource.identifier+'/format=thumbnail',
69 'poster_ani' : _this.dnUrl + resource.identifier+'/format=Animated+Gif',
72 'desc' : resource.description,
73 'src' : _this.dnUrl + resource.identifier+'/format=Ogg+video',
74 'mime' : 'application/ogg',
75 //set the licence: (rsd is a pointer to the parent remoteSearchDriver )
76 'license' : this.rsd.getLicenceFromUrl( resource.licenseurl ),
80 this.resultsObj[ resource_id ] = rObj;
82 //likely a audio clip if no poster and type application/ogg
83 //@@todo we should return audio/ogg for the mime type or some other way to specify its "audio"
86 //for(var i in this.resultsObj[page_id]){
87 // js_log('added: '+ i +' '+ this.resultsObj[page_id][i]);
92 getEmbedTimeMeta:function(rObj, callback){
96 'url':_this.dnUrl + rObj.resourceKey + '/format=Ogg+video'
100 rObj.duration = data['length'];
102 rObj.width = data['width'];
104 rObj.height = data['height'];
109 getEmbedHTML: function( rObj , options) {
110 js_log('getEmbedHTML:: ' + rObj.poster );
113 var id_attr = (options['id'])?' id = "' + options['id'] +'" ': '';
114 var src = rObj.src + '?t=0:0:0/'+ seconds2npt( rObj.duration );
115 if(rObj.mime == 'application/ogg' || rObj.mime == 'audio/ogg' || rObj.mime=='video/ogg'){
116 return '<video ' + id_attr + ' src="' + src + '" poster="' + rObj.poster + '" type="video/ogg"></video>';