r32533 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32532‎ | r32533 | r32534 >
Date:02:36, 28 March 2008
Author:dale
Status:old
Tags:
Comment:
conformed roe export and parsing to http://svn.annodex.net/standards/roe/roe_1_0.xsd
Modified paths:
  • /trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Component.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/ogg_thumb_insert.php (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/maintenance/ogg_thumb_insert.php
@@ -28,8 +28,8 @@
2929 ogg_thumb_insert.php 17 /var/www/localhost/htdocs/media/stream.ogg 20
3030
3131 Notes:
32 - if possible you want to use the source footage rather than the ogg to generat thumbnails (ie the mpeg2 or dv)
33 -EOT;
 32+ if possible you want to use the source footage rather than the ogg to generate the thumbnails (ie the mpeg2 or dv)
 33+EOT;
3434 exit ();
3535 }
3636 $streamid=$args[0];
Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php
@@ -53,17 +53,16 @@
5454 $this->stream_name = $wgRequest->getVal('stream_name');
5555 if($this->stream_name=='')$error_page.=wfMsg('edit_stream_missing').", ";
5656 $this->req_time = $wgRequest->getVal('t');
57 - if($this->req_time=='')$error_page.=wfMsg('mv_missing_req_time');
58 - if(!$this->req_time)$this->req_time = $wgRequest->getVal('time_range');
5957
6058 switch($this->feed_format ){
6159 case 'cmml':
6260 $this->get_stream_cmml();
6361 break;
64 - case 'jroe':
 62+ /* disabled for now
 63+ * case 'jroe':
6564 //returns roe stream info in json object for easy DOM injection
6665 $this->get_roe_json();
67 - break;
 66+ break;*/
6867 case 'roe':
6968 $this->get_roe_xml();
7069 break;
@@ -124,9 +123,9 @@
125124 die('stream does not exist');
126125 }
127126 $this->streamPageTitle = Title::newFromText($this->stream_name.'/'.$this->req_time, MV_NS_STREAM);
128 - //get the default mvd set:
 127+ //get the requested mvd set:
129128 $this->mvcp = new MV_Component();
130 - $this->mvcp->procMVDReqSet();
 129+ $this->mvcp->procMVDReqSet($only_requested=true);
131130
132131 //get all track types avaliable in current range:
133132 $this->mvd_type_res = MV_Index::getMVDTypeInRange($this->mvTitle->getStreamId(),
@@ -136,7 +135,7 @@
137136 //get all avaliable files
138137 $this->file_list =$this->mvTitle->mvStream->getFileList();
139138 }
140 - function get_roe_json(){
 139+ /*function get_roe_json(){
141140 $fname = 'Mv_SpecialExport::get_roe_json';
142141 wfProfileIn( $fname );
143142 $this->get_row_data();
@@ -149,7 +148,7 @@
150149 $jsonContents = xml2json::transformXmlStringToJson($xml_page);
151150 print $jsonContents;
152151 wfProfileOut($fname);
153 - }
 152+ }*/
154153 //start high level:
155154 function get_roe_xml($header=true){
156155 global $mvDefaultVideoQualityKey, $wgServer;
@@ -176,7 +175,7 @@
177176 $dAttr=($file->getNameKey()==$mvDefaultVideoQualityKey)?' default="true"':'';
178177 $dSrc=($file->getPathType()=='url_anx')?$this->mvTitle->getWebStreamURL($file->getNameKey()):$file->getFullURL();
179178 ?>
180 - <video id="<?=htmlentities($file->getNameKey())?>"<?=$dAttr?> src="<?=$dSrc?>" title="<?=htmlentities($file->get_desc())?>" content-type="<?=htmlentities($file->getContentType())?>" />
 179+ <mediaSource id="<?=htmlentities($file->getNameKey())?>"<?=$dAttr?> src="<?=$dSrc?>" title="<?=htmlentities($file->get_desc())?>" content-type="<?=htmlentities($file->getContentType())?>" />
181180 <?}?>
182181 </switch>
183182 </track>
@@ -186,18 +185,18 @@
187186 //output cmml header:
188187 //@@todo lookup language for layer key patterns
189188 $sTitle = Title::makeTitle(NS_SPECIAL, 'MvExportStream');
190 - $query = 'stream_name='.$this->stream_name.'&feed_format=cmml&tracks='.strtolower($row->mvd_type);
191 - $clink = $sTitle->getFullURL($query);
 189+ $query = 'stream_name='.$this->stream_name.'&t='.$this->req_time.'&feed_format=cmml&tracks='.strtolower($row->mvd_type);
 190+ $clink = $sTitle->getFullURL($query);
 191+ $inline = (in_array(strtolower($row->mvd_type), $this->mvcp->mvd_tracks))?'true':'false';
192192 ?>
193 - <text id="<?=$row->mvd_type?>" title="<?=wfMsg($row->mvd_type)?>" node_count="<?=$row->count?>" lang="en" content-type="text/cmml" src="<?=htmlentities($clink)?>">
 193+ <mediaSource id="<?=$row->mvd_type?>" title="<?=wfMsg($row->mvd_type)?>" inline="<?=$inline?>" lang="en" content-type="text/cmml" src="<?=htmlentities($clink)?>">
194194 <?
195 - //output inline cmml:
196 - if(in_array(strtolower($row->mvd_type), $this->mvcp->mvd_tracks)){
 195+ //output inline cmml (if requested):
 196+ if($inline=='true'){
197197 $this->get_stream_cmml(true, $row->mvd_type);
198198 }
199 - //close text track
200199 ?>
201 - </text>
 200+ </mediaSource>
202201 <?
203202 }
204203 ?>
@@ -263,8 +262,7 @@
264263 <<?=$ns?>title><?=wfMsg($role)?></<?=$ns?>title>
265264 <<?=$ns?>description><?=htmlentities(wfMsg($role.'_desc'))?></<?=$ns?>description>
266265 </<?=$ns?>head>
267 - <?=$body_string?>
268 -
 266+ <?=$body_string?>
269267 </cmml>
270268 <?
271269 }
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Component.php
@@ -25,7 +25,7 @@
2626 }
2727 //process the request set (load from settings if not set in url
2828 //@@todo would be good to allow user-set preference in the future)
29 - function procMVDReqSet(){
 29+ function procMVDReqSet($only_requested=false){
3030 global $wgRequest;
3131 global $mvMVDTypeDefaultDisp, $mvMVDTypeAllAvailable;
3232 //if already computed return:
@@ -39,16 +39,18 @@
4040 $this->mvd_tracks[]= $tk;
4141 }
4242 }
43 - }else{
44 - //do reality check on settings:
45 - foreach($mvMVDTypeDefaultDisp as $tk){
46 - if(!in_array($tk, $mvMVDTypeAllAvailable)){
47 - global $wgOut;
48 - $wgOut->errorPage('mvd_default_mismatch','mvd_default_mismatch_text');
49 - }
 43+ }else{
 44+ if(!$only_requested){
 45+ //set the default tracks (if not restricted to requested tracks)
 46+ foreach($mvMVDTypeDefaultDisp as $tk){
 47+ if(!in_array($tk, $mvMVDTypeAllAvailable)){
 48+ global $wgOut;
 49+ $wgOut->errorPage('mvd_default_mismatch','mvd_default_mismatch_text');
 50+ }
 51+ }
 52+ //just set to global default:
 53+ $this->mvd_tracks = $mvMVDTypeDefaultDisp;
5054 }
51 - //just set to global default:
52 - $this->mvd_tracks = $mvMVDTypeDefaultDisp;
5355 }
5456 }
5557 function getStateReq(){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -89,6 +89,8 @@
9090
9191 //roe url (for xml based metadata)
9292 "roe":null,
 93+ //if roe includes metadata tracks we can expose a link to metadata
 94+ "show_meta_link":false,
9395
9496 //custom attributes for mv_embed:
9597 "play_button":true,
@@ -771,18 +773,29 @@
772774 if(typeof data == 'object' ){
773775 js_log('type of data is object');
774776 _this.roe_data = data;
 777+
 778+ $j.each(_this.roe_data.getElementsByTagName('mediaSource'), function(inx, n){
 779+ if(n.getAttribute('content-type')=='video/ogg' && n.getAttribute("default")=="true"){
 780+ js_log('set src to '+n.getAttribute("src"));
 781+ _this['src'] = n.getAttribute("src");
 782+ }
 783+ if(n.getAttribute('content-type')=='text/cmml'){
 784+ js_log('cmml available');
 785+ _this['show_meta_link']=true;
 786+ }
 787+ });
 788+ /*
775789 //set the src to video tag with "default" attribute:
776 - var rVids = _this.roe_data.getElementsByTagName('video');
 790+ //var rVids = _this.roe_data.getElementsByTagName('video');
777791 js_log('found '+ rVids.length + ' video tags');
778792 $j.each(_this.roe_data.getElementsByTagName('video'), function(inx,n){
779793 if(n.getAttribute("default")=="true"){
780794 js_log('set src to '+n.getAttribute("src"));
781795 _this['src'] = n.getAttribute("src");
782796 }
783 - });
 797+ });
 798+ */
784799 //set the thumbnail:
785 - //for some reason getElementById does not work > ?
786 - //rThumb = this.roe_data.getElementById('stream_thumb');
787800 $j.each(_this.roe_data.getElementsByTagName('img'), function(inx, n){
788801 if(n.getAttribute("id")=="stream_thumb"){
789802 js_log('set thumb to '+n.getAttribute("src"));
@@ -1427,7 +1440,16 @@
14281441 }
14291442 function do_request(req_url,callback,mv_json_response){
14301443 js_log('do request: ' + req_url);
1431 - if( parseUri(document.URL).host != parseUri(req_url).host){
 1444+ if( parseUri(document.URL).host == parseUri(req_url).host){
 1445+ //no proxy at all do a direct request:
 1446+ $j.ajax({
 1447+ type: "GET",
 1448+ url:req_url,
 1449+ success:function(data){
 1450+ callback(data);
 1451+ }
 1452+ });
 1453+ }else{
14321454 //check if MV_embed path matches document.URL then we can use the local proxy:
14331455 if(parseUri(document.URL).host == parseUri(mv_embed_path).host ){
14341456 js_log('use mv_embed_proxy : ' + parseUri(document.URL).host + ' != '+ parseUri(req_url).host);
@@ -1443,7 +1465,6 @@
14441466 //need to get data via DOM proxy injection with callback
14451467 global_req_cb.push(callback);
14461468 if(!mv_json_response){
1447 - //swap out & in req url:
14481469 req_url =req_url.replace(/&/g,'__amp__');
14491470 loadExternalJs(mv_embed_path+'mv_data_proxy.php?url='+req_url+
14501471 '&cb=mv_jsdata_cb&cb_inx='+(global_req_cb.length-1) );
@@ -1452,16 +1473,7 @@
14531474 loadExternalJs(req_url+'&cb=mv_jsdata_cb&cb_inx='+(global_req_cb.length-1));
14541475 }
14551476 }
1456 - }else{
1457 - //no proxy at all do a direct request:
1458 - $j.ajax({
1459 - type: "GET",
1460 - url:req_url,
1461 - success:function(data){
1462 - callback(data);
1463 - }
1464 - });
1465 - }
 1477+ }
14661478 }
14671479 function mv_jsdata_cb(response){
14681480 //run the callback from the global req cb object:

Status & tagging log