Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/seqRemoteSearchDriver.js |
— | — | @@ -97,26 +97,16 @@ |
98 | 98 | //get target order: |
99 | 99 | var cat = rObj; |
100 | 100 | //check for target insert path |
101 | | - this.checkImportResource( rObj, function(){ |
102 | | - //get the local src file (if we imported) : |
103 | | - do_api_req({ |
104 | | - 'data': { |
105 | | - 'action' : 'query', |
106 | | - 'prop' : 'imageinfo', |
107 | | - 'iiprop' : 'url' |
108 | | - }, |
109 | | - 'url': _this.local_wiki_api_url |
110 | | - }, function(data){ |
111 | | - debugger; |
112 | | - }); |
113 | | - |
114 | | - var clipConfig = { |
115 | | - 'src' : rObj.src, |
| 101 | + this.checkImportResource( rObj, function(){ |
| 102 | + var clipConfig = { |
116 | 103 | 'type' : rObj.mime, |
117 | | - 'uri' : _this.cFileNS + ':' + rObj.target_resource_title, |
118 | | - 'poster' : rObj.poster, |
| 104 | + 'uri' : _this.cFileNS + ':' + rObj.target_resource_title, |
119 | 105 | 'title' : rObj.title |
120 | 106 | }; |
| 107 | + //set via local properites if avaliable |
| 108 | + clipConfig['src'] = (rObj.local_src) ? rObj.local_src : rObj.src; |
| 109 | + clipConfig['poster'] = (rObj.local_poster) ? rObj.local_poster : rObj.poster; |
| 110 | + |
121 | 111 | if(rObj.start_time && rObj.end_time){ |
122 | 112 | clipConfig['dur'] = npt2seconds( rObj.end_time ) - npt2seconds( rObj.start_time ); |
123 | 113 | } |
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -1150,7 +1150,7 @@ |
1151 | 1151 | var _this = this; |
1152 | 1152 | |
1153 | 1153 | //check if local repository |
1154 | | - //or if import mode if just "linking" |
| 1154 | + //or if import mode if just "linking" (we should alaredy have the 'url' |
1155 | 1155 | if( this.checkRepoLocal( cp ) || this.import_url_mode == 'remote_link'){ |
1156 | 1156 | //local repo jump directly to check Import Resource callback: |
1157 | 1157 | cir_callback( rObj ); |
— | — | @@ -1162,7 +1162,10 @@ |
1163 | 1163 | //check if the resource is not already on this wiki |
1164 | 1164 | reqObj={ |
1165 | 1165 | 'action':'query', |
1166 | | - 'titles': _this.cFileNS + ':' + rObj.target_resource_title |
| 1166 | + 'titles': _this.cFileNS + ':' + rObj.target_resource_title, |
| 1167 | + 'prop' : 'imageinfo', |
| 1168 | + 'iiprop' : 'url', |
| 1169 | + 'iiurlwidth': '400' |
1167 | 1170 | }; |
1168 | 1171 | |
1169 | 1172 | do_api_req( { |
— | — | @@ -1174,12 +1177,16 @@ |
1175 | 1178 | if( i != '-1' && i != '-2' ){ |
1176 | 1179 | js_log('found title: ' + i + ':' + data.query.pages[i]['title']); |
1177 | 1180 | found_title=data.query.pages[i]['title']; |
| 1181 | + //update to local src |
| 1182 | + rObj.local_src = data.query.pages[i]['imageinfo'][0].url; |
| 1183 | + //@@todo maybe update poster too? |
| 1184 | + rObj.local_poster = data.query.pages[i]['imageinfo'][0].thumburl; |
1178 | 1185 | } |
1179 | 1186 | } |
1180 | 1187 | if( found_title ){ |
1181 | 1188 | js_log("checkImportResource:found title:" + found_title); |
1182 | 1189 | //resource is already present (or resource with same name is already present) |
1183 | | - rObj.target_resource_title = found_title.replace(/File:|Image:/,''); |
| 1190 | + rObj.target_resource_title = found_title.replace(/File:|Image:/,''); |
1184 | 1191 | cir_callback( rObj ); |
1185 | 1192 | }else{ |
1186 | 1193 | js_log("resource not present: update:"+ _this.cFileNS + ':' + rObj.target_resource_title); |