r46543 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46542‎ | r46543 | r46544 >
Date:18:07, 29 January 2009
Author:dale
Status:deferred
Tags:
Comment:
* fixes for stand alone files (ogv) & plugin based duration checks
* firefog version checks
* maintenance scripts updates
* minor style fix for playhead
* export empty variable fix
Modified paths:
  • /trunk/extensions/MetavidWiki/includes/MV_DefaultSettings.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/maintenance_util.inc.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/video_ocr_thumb_insert.php (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/add_media_wizard.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/firefogg.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mv_upload.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_flashEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/styles.css (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/maintenance/video_ocr_thumb_insert.php
@@ -14,7 +14,7 @@
1515 // include commandLine.inc from the mediaWiki maintance dir:
1616 require_once ( '../../../maintenance/commandLine.inc' );
1717 require_once ( 'metavid2mvWiki.inc.php' );
18 -
 18+
1919 // include util functions:
2020 require_once( 'maintenance_util.inc.php' );
2121
@@ -53,28 +53,28 @@
5454 $filename = $workingdir .'/'. $stream_name . '.mpeg';
5555 $duration = getDuration($filename);
5656
 57+
 58+//read the timestamp from the .srt
 59+$srt_file = $workingdir . '/' . $stream_name . '.srt';
 60+$srt_ary = file( $srt_file );
 61+if($srt_ary === false)
 62+ die(' could not find srt file: ' . $srt_file);
 63+
 64+//time stamp:
 65+$org_start_time = intval( trim( str_replace( 'starttime' , '', $srt_ary[2] )) );
 66+
 67+class streamObject{ };
 68+$stream = new streamObject();
 69+$stream->name = $stream_name;
 70+$stream->org_start_time = $org_start_time;
 71+$stream->sync_status = 'in_sync';
 72+$stream->duration = $duration;
 73+
 74+
5775 $mvTitle = new MV_Title( 'Stream:' . $stream_name );
5876 if ( !$mvTitle->doesStreamExist() ) {
5977 print $stream_name . " does not exist ... creating\n";
60 - // print 'do stream desc'."\n";
61 - include_once('metavid2mvWiki.inc.php');
62 -
63 - //read the timestamp from the .srt (this should be unified)
64 - $srt_file = $workingdir . '/' . $stream_name . '.srt';
65 - $srt_ary = file( $srt_file );
66 - if($srt_ary === false)
67 - die(' could not find srt file: ' . $srt_file);
68 -
69 - //time stamp:
70 - $org_start_time = intval( trim( str_replace( 'starttime' , '', $srt_ary[2] )) );
71 - class streamObject{
72 -
73 - }
74 - $stream = new streamObject();
75 - $stream->name = $stream_name;
76 - $stream->org_start_time = $org_start_time;
77 - $stream->sync_status = 'in_sync';
78 - $stream->duration = $duration;
 78+ // print 'do stream desc'."\n";
7979
8080 if(!isset($MVStreams))
8181 $MVStreams = array();
@@ -86,8 +86,16 @@
8787 }
8888 $stream_id = $mvTitle->getStreamId();
8989 print 'got stream id: '. $stream_id . "\n";
 90+
 91+//check for & update stream files:
 92+do_stream_file_check( $stream );
 93+
 94+
9095 $filedir = '/video/metavid/mvprime_stream_images/' . MV_StreamImage::getRelativeImagePath( $stream_id );
91 -
 96+if(!is_dir($filedir)){
 97+ shell_exec("mkdir {$filedir}");
 98+ shell_exec("chmod -R 777 {$filedir}");
 99+}
92100 echo "working on: $filename \n";
93101 $ocroutput = "";
94102 //@@TODO we should do sequential output and parse the OCR file if it already exists.
@@ -110,8 +118,8 @@
111119
112120 //get ocr:
113121 shell_exec("convert {$filedir}/{$i}.jpg -crop 457x30+63+358 {$workingdir}/temp.{$stream_id}.ocr.tif && convert {$workingdir}/temp.{$stream_id}.ocr.tif -resize 300% -level 10%,1,20% -monochrome +compress {$workingdir}/temp.{$stream_id}.ocr.tif");
114 - shell_exec("tesseract {$workingdir}/temp.{$stream_id}.ocr.tif {$workingdir}/ocrtemp{$i} nobatch lettersonly 2>&1");
115 - $ocr = shell_exec("tail {$workingdir}/ocrtemp{$i}.txt") ." at " . seconds2ntp($i) ." \n";
 122+ shell_exec("tesseract {$workingdir}/temp.{$stream_id}.ocr.tif {$workingdir}/ocrtemp{$stream_id} nobatch lettersonly 2>&1");
 123+ $ocr = shell_exec("tail {$workingdir}/ocrtemp{$stream_id}.txt") ." at " . seconds2ntp($i) ." \n";
116124 echo 'got ocr:'. $ocr;
117125 $ocroutput .= $ocr;
118126
@@ -120,7 +128,7 @@
121129 }
122130 }
123131 //remove temporary files:
124 -shell_exec("rm {$workingdir}ocrtemp{$i}.txt");
 132+shell_exec("rm {$workingdir}/ocrtemp{$i}.txt");
125133 shell_exec("rm {$workingdir}/temp.{$stream_id}.ocr.tif");
126134
127135 $ocrfileloc = "$workingdir/$stream_name.ocr";
Index: trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.php
@@ -130,6 +130,9 @@
131131 case 'interest':
132132 do_people_insert( $lookUpInterest = true );
133133 break;
 134+ case 'file_check':
 135+ do_stream_file_check();
 136+ break;
134137 case 'update_templates' :
135138 $force = ( isset( $options['force'] ) ) ? true:false;
136139 include_once( 'metavid_gov_templates.php' );
Index: trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php
@@ -34,105 +34,110 @@
3535 // if($i==3)die;
3636 // $i++;
3737 }
38 -function do_stream_file_check( & $old_stream ) {
 38+function do_stream_file_check( $old_stream=false ) {
3939 global $mvgIP, $mvVideoArchivePaths;
40 - $mvStream = & mvGetMVStream( array (
41 - 'name' => $old_stream->name
42 - ) );
43 - $file_list = $mvStream->getFileList();
44 -
45 - // if ($old_stream->trascoded != 'none') {
46 - // print "transcode is: " . $old_stream->trascoded;
47 - /*if ($old_stream->trascoded == 'low')
48 - $set = array (
49 - 'mv_ogg_low_quality'
50 - );
51 - if ($old_stream->trascoded == 'high')
52 - $set = array (
53 - 'mv_ogg_high_quality'
54 - );
55 - if ($old_stream->trascoded == 'all')
56 - $set = array (
57 - 'mv_ogg_high_quality',
58 - 'mv_ogg_low_quality'
59 - );*/
60 - // find the files and check for them on the servers:
61 - // @@todo have multiple file locations for same file?
62 - $set = array();
63 - foreach ( $mvVideoArchivePaths as $path ) {
64 - if ( url_exists( $path . $old_stream->name . '.ogg' ) ) {
65 - $set['mv_ogg_low_quality'] = $path . $old_stream->name . '.ogg';
66 - // force cap1 path @@todo remove!:
67 - // $set['mv_ogg_low_quality']='http://128.114.20.64/media/' . $old_stream->name . '.ogg';
 40+ $stream_set = Array();
 41+ if($old_stream==false){
 42+ $dbr = wfGetDB( DB_READ );
 43+ $result = $dbr->select( 'mv_streams',
 44+ array('name','state','date_start_time','duration'),
 45+ '',
 46+ __METHOD__,
 47+ array('LIMIT'=> 9000));
 48+ if ( $dbr->numRows( $result ) == 0 )die("do_stream_file_check: no streams found");
 49+ while ( $row = $dbr->fetchObject( $result ) ) {
 50+ $stream_set[] = $row;
6851 }
69 - if ( url_exists( $path . $old_stream->name . '.HQ.ogg' ) ) {
70 - $set['mv_ogg_high_quality'] = $path . $old_stream->name . '.HQ.ogg';
71 - // force cap1 path @@todo remove!:
72 - // $set['mv_ogg_high_quality']='http://128.114.20.64/media/' . $old_stream->name . '.HQ.ogg';
73 - }
 52+ }else{
 53+ $stream_set = Array( $old_stream );
7454 }
75 - if ( count( $set ) == 0 ) {
76 - // no files present (remove stream)
77 - print 'no files present should remove: ' . $old_stream->name . "\n";
78 - // make a valid mv title (with requted time: )
79 - /*$mvTitle = new MV_Title( $old_stream->name);
80 -
81 - $streamTitle = Title::newFromText( $old_stream->name, MV_NS_STREAM);
82 - //print " new title: " . $streamTitle . "\n";
83 - $article = new MV_StreamPage($streamTitle, $mvTitle);
84 - $article->doDelete('no files present for stream');*/
85 - }
86 - // print "set: " . print_r($set);
87 - // remove old file pointers:
88 - $dbw = wfGetDB( DB_WRITE );
89 - $sql = "DELETE FROM `mv_stream_files` WHERE `stream_id`=" . $mvStream->id . " AND " .
90 - "(`file_desc_msg`='mv_ogg_high_quality' OR `file_desc_msg`='mv_ogg_low_quality')";
91 - $dbw->query( $sql );
92 - // update files:
93 - foreach ( $set as $qf => $path_url ) {
94 - do_insert_stream_file( $mvStream, $path_url, $qf );
95 - }
96 - // }
97 - // check for archive.org stuff too..
98 - /*if($old_stream->archive_org!=''){
99 - $found=false;
100 - foreach($file_list as $file){
101 - if($file->path_type =='ext_archive_org'){
102 - $found=true;
 55+ foreach($stream_set as $stream){
 56+ $mvStream = & mvGetMVStream( array (
 57+ 'name' => $stream->name,
 58+ 'duration' => $stream->duration
 59+ ) );
 60+ $file_list = $mvStream->getFileList();
 61+ //print 'f:do_stream_file_check:' . $stream->name . ' dur: ' . $mvStream->getDuration() . "\n";
 62+
 63+ // @@todo have multiple file locations for same file?
 64+ $set = array();
 65+ foreach ( $mvVideoArchivePaths as $path ) {
 66+ if ( url_exists( $path . $stream->name . '.ogg' ) ) {
 67+ $set['mv_ogg_low_quality'] = $path . $stream->name . '.ogg';
 68+ // force cap1 path @@todo remove!:
 69+ // $set['mv_ogg_low_quality']='http://128.114.20.64/media/' . $stream->name . '.ogg';
10370 }
 71+ if ( url_exists( $path . $stream->name . '.HQ.ogg' ) ) {
 72+ $set['mv_ogg_high_quality'] = $path . $stream->name . '.HQ.ogg';
 73+ // force cap1 path @@todo remove!:
 74+ // $set['mv_ogg_high_quality']='http://128.114.20.64/media/' . $stream->name . '.HQ.ogg';
 75+ }
 76+ if ( url_exists( $path . $stream->name . '.flv' ) ) {
 77+ $path = str_replace('/media/','', $path);
 78+ $set['mv_flash_low_quality'] = $path . '/mvFlvServer.php/'. $stream->name . '.flv';
 79+ // force cap1 path @@todo remove!:
 80+ // $set['mv_ogg_high_quality']='http://128.114.20.64/media/' . $stream->name . '.HQ.ogg';
 81+ }
10482 }
105 - if(!$found)do_insert_stream_file($mvStream, $old_stream, 'mv_archive_org_link');
106 - }*/
 83+ if ( count( $set ) == 0 ) {
 84+ // no files present (remove stream)
 85+ print 'no files present should remove: ' . $stream->name . "\n";
 86+ continue;
 87+ }
 88+ $dbw = wfGetDB( DB_WRITE );
 89+ $sql = "DELETE FROM `mv_stream_files` WHERE `stream_id`=" . $mvStream->id . " AND " .
 90+ "(`file_desc_msg`='mv_ogg_high_quality' " .
 91+ " OR `file_desc_msg`='mv_ogg_low_quality' " .
 92+ " OR `file_desc_msg`='mv_flash_low_quality')";
 93+ $dbw->query( $sql );
 94+ // update files:
 95+ if(!isset($set['mv_ogg_low_quality'])){
 96+ print "Missing lowQ ogg for: " .$stream->name ."\n";
 97+ }
 98+ if(!isset($set['mv_ogg_high_quality'])){
 99+ print "Missing highQ ogg for: " .$stream->name ."\n";
 100+ }
 101+ if(!isset($set['mv_flash_low_quality'])){
 102+ print "Missing flash for: " .$stream->name ."\n";
 103+ }
 104+ foreach ( $set as $qf => $path_url ) {
 105+ do_insert_stream_file( $mvStream, $path_url, $qf );
 106+ }
 107+ }
107108 }
108109
109110 function do_insert_stream_file( $mvStream, $path, $quality_msg ) {
110111 global $mvVideoArchivePaths;
111112 $dbw = wfGetDB( DB_WRITE );
112 -
113 - // get file duration from nfo file (if avaliable ):
114 - $nfo_url = $path . '.nfo';
115 - $nfo_txt = @file( $nfo_url );
116 - if ( $nfo_txt ) {
117 - if ( isset( $nfo_txt[0] ) ) {
118 - list( $na, $len ) = explode( 'n:', $nfo_txt[0] );
119 - $len = trim( $len );
120 - // trim leading zero
121 - if ( $len[0] == '0' )$len = substr( $len, 1 );
122 - // trim sub frame times:
123 - if ( strpos( $len, '.' ) !== false ) {
124 - $len = substr( $len, 0, strpos( $len, '.' ) );
 113+ $dur = $mvStream->getDuration();
 114+ // get file duration from nfo file :
 115+ if($dur == 0){
 116+ $nfo_url = $path . '.nfo';
 117+ if( url_exists($nfo_url) ){
 118+ $nfo_txt = @file( $nfo_url );
 119+ if ( $nfo_txt !== false ) {
 120+ if ( isset( $nfo_txt[0] ) ) {
 121+ list( $na, $len ) = explode( 'n:', $nfo_txt[0] );
 122+ $len = trim( $len );
 123+ // trim leading zero
 124+ if ( $len[0] == '0' )$len = substr( $len, 1 );
 125+ // trim sub frame times:
 126+ if ( strpos( $len, '.' ) !== false ) {
 127+ $len = substr( $len, 0, strpos( $len, '.' ) );
 128+ }
 129+ $dur = ntp2seconds( $len );
 130+ } else {
 131+ echo "empty nfo file: $nfo_url \n";
 132+ $dur = 0;
 133+ }
 134+ } else {
 135+ echo "missing nfo file: $nfo_url \n";
 136+ $dur = 0;
125137 }
126 - $dur = ntp2seconds( $len );
127 - } else {
128 - echo "empty nfo file: $nfo_url \n";
129 - $dur = 0;
130138 }
131 - } else {
132 - echo "missing nfo file: $nfo_url \n";
133 - $dur = 0;
134139 }
135140 $sql = "INSERT INTO `mv_stream_files` (`stream_id`, `file_desc_msg`, `path`, `duration`)" .
136 - " VALUES ('{$mvStream->id}', '{$quality_msg}', " . " '{$path}', {$dur} )";
 141+ " VALUES ('{$mvStream->id}', '{$quality_msg}', '{$path}', {$dur} )";
137142 $dbw->query( $sql );
138143 }
139144 // @@todo convert to MV_EditStream
Index: trunk/extensions/MetavidWiki/maintenance/maintenance_util.inc.php
@@ -193,7 +193,7 @@
194194 return $new_n;
195195 }
196196 function url_exists( $url ) {
197 - $url = str_replace( "http://", "", $url );
 197+ $url = str_replace( "http://", "", $url );
198198 if ( strstr( $url, "/" ) ) {
199199 $url = explode( "/", $url, 2 );
200200 $url[1] = "/" . $url[1];
Index: trunk/extensions/MetavidWiki/includes/MV_DefaultSettings.php
@@ -88,8 +88,8 @@
8989 $mvShellOggFrameGrab = '';
9090
9191 # define the video media locations based on path/server names
92 -$mvVideoArchivePaths['mvprime'] = 'http://metavid.org/media/';
93 -$mvVideoArchivePaths['cap1'] = 'http://128.114.20.64/media/';
 92+$mvVideoArchivePaths['cap1'] = 'http://metavidstorage01.ucsc.edu/media/';
 93+$mvVideoArchivePaths['mvbox2'] = 'http://mvbox2.cse.ucsc.edu/media/';
9494
9595 // stream msgKeys that support ?t=start_time/end_time temporal url media serving:
9696 $mvDefaultVideoQualityKey = 'mv_ogg_low_quality';
Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php
@@ -594,7 +594,7 @@
595595 //check a few different types:
596596 $stream_url = $mvTitle->getWebStreamURL($mvDefaultVideoQualityKey);
597597 if($stream_url !== false && isset( $mvVidQualityMsgKeyType[ $mvDefaultVideoQualityKey ]) ) {
598 - echo '<enclosure name="'. wfMsg($vid_key) .'" type="video/ogg" url="'. mvRSSFeed::xmlEncode( $ogg_stream_url ) .'"/>';
 598+ echo '<enclosure name="'. wfMsg($mvDefaultVideoQualityKey) .'" type="video/ogg" url="'. mvRSSFeed::xmlEncode( $ogg_stream_url ) .'"/>';
599599 }
600600 ?>
601601 <comments>
Index: trunk/extensions/MetavidWiki/skins/add_media_wizard.js
@@ -8,7 +8,6 @@
99
1010 //if mv_embed is hosted somewhere other than near by the add_media_wizard you can define it here:
1111 var mv_add_media_wizard_path = 'http://mvbox2.cse.ucsc.edu/w/extensions/MetavidWiki/skins/';
12 -var mv_add_media_wizard_path = 'http://localhost/wiki/extensions/MetavidWiki/skins/';
1312
1413
1514 //*code should not have to modify anything below*/
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mv_upload.js
@@ -11,6 +11,7 @@
1212 gMsg['upload-transcoded-status'] = 'Transcoded';
1313 gMsg['uploaded-status'] = 'Uploaded';
1414 gMsg['upload-select-file'] = 'Select File...';
 15+gMsg['wgfogg_wrong_version'] = 'You have firefogg installed but its outdated, <a href="http://firefogg.org">please upgrade</a> ';
1516
1617 var default_upload_options = {
1718 'target_div':'',
@@ -86,7 +87,7 @@
8788 //if firefog is not taking over the submit we can here:
8889 if( ! init_firefogg( intFirefoggObj ) ){
8990 //firefogg handles the form submit (even on image uploads when called by gui)
90 - if( !this.on_upload_page ){
 91+ if( ! this.on_upload_page ){
9192
9293 }
9394 }
@@ -101,6 +102,9 @@
102103 '<span id="wgfogg_not_installed">' +
103104 getMsg('upload-fogg_not_installed') +
104105 '</span>'+
 106+ '<span id="wgfogg_wrong_version">'+
 107+ getMsg('wgfogg_wrong_version')+
 108+ '</span>'+
105109 '<span id="wgfogg_installed" style="display:none" >'+
106110 '<input id="wgEnableFirefogg" type="checkbox" name="wgEnableFirefogg" >' +
107111 getMsg('upload-enable-converter') +
@@ -109,7 +113,7 @@
110114 //hard code style (since not always easy to import style sheets)
111115 $j('[@name=wpUpload]').eq(0).before('<div id="dlbox-centered" class="dlbox-centered" style="display:none;'+
112116 'position:fixed;background:#DDD;border:3px solid #AAA;font-size:115%;width:40%;'+
113 - 'height:50%;padding: 10px;z-index:100;top:50%;left:15%;" >'+
 117+ 'height:50%;padding: 10px;z-index:100;top:30%;left:15%;" >'+
114118 '<h5>' + getMsg('upload-in-progress') + '</h5>' +
115119 '<div id="fogg-pbar-container" style="border:solid thin gray;width:90%;height:15px;" >' +
116120 '<div id="fogg-progressbar" style="background:#AAC;width:0%;height:15px;"></div>' +
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/firefogg.js
@@ -8,6 +8,7 @@
99 init_firefogg();
1010 });
1111 }
 12+var min_firefogg_version = '0.9.2';
1213 function init_firefogg( iObj ){
1314 if(!iObj)
1415 iObj = {};
@@ -21,8 +22,12 @@
2223 }else{
2324 e = document.getElementById('wgfogg_not_installed');
2425 if(e)
 26+ e.style.display='none';
 27+
 28+ e = document.getElementById('wgfogg_wrong_version');
 29+ if(e)
2530 e.style.display='none';
26 -
 31+
2732 e = document.getElementById('wgfogg_installed');
2833 if(e)
2934 e.style.display='inline';
@@ -32,6 +37,18 @@
3338 js_log('wgEnableFirefogg found:');
3439 //get a new fogg object with default options
3540 var fogg = new upFirefogg( iObj );
 41+
 42+ //do the version check:
 43+ var fv = fogg.ogg.version;
 44+ if(fv.replace(/[^0-9]/gi, '') < min_firefogg_version.replace(/[^0-9]/gi, '') ){
 45+ e = document.getElementById('wgfogg_wrong_version');
 46+ if(e)
 47+ e.style.display='inline';
 48+
 49+ e = document.getElementById('wgfogg_installed');
 50+ if(e)
 51+ e.style.display='none';
 52+ }
3653
3754 //make sure the checkbox accurately reflects the current state:
3855 if(fogg.enabled == false)
@@ -68,6 +85,8 @@
6986 this[i] = default_firefogg_options[i];
7087 }
7188 }
 89+ //init the Firefogg obj
 90+ this.ogg = new Firefogg();
7291 },
7392 enable_fogg:function(){
7493 var _this = this;
@@ -87,7 +106,7 @@
88107 sfe = document.getElementById('fogg-video-file');
89108 if(sfe) sfe.style.display='inline';
90109
91 - _this.ogg = new Firefogg();
 110+
92111 addHandler( sfe, 'click', function(){
93112 //add binding:
94113 _this.select_fogg();
Index: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/styles.css
@@ -256,7 +256,7 @@
257257 z-index: 4;
258258 float: right;
259259 display: inline;
260 - margin: -13px 0 0 0;
 260+ margin: -12px 0 0 0;
261261 background: url(images/player_seek_right.png) 0 0 no-repeat;
262262 }
263263 .videoPlayer .seeker .mv_progress{
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -1410,7 +1410,7 @@
14111411 var no_param_uri = uri.substr(0, end_inx);
14121412 switch( no_param_uri.substr(no_param_uri.lastIndexOf('.'),4) ){
14131413 case '.flv':return 'video/x-flv';break;
1414 - case '.ogg':return 'video/ogg';break;
 1414+ case '.ogg': case '.ogv': return 'video/ogg';break;
14151415 case '.anx':return 'video/ogg';break;
14161416 }
14171417 }
@@ -1903,13 +1903,21 @@
19041904 return default_time_req;
19051905 return this.media_element.selected_source.start_ntp+'/'+this.media_element.selected_source.end_ntp;
19061906 },
1907 - getDuration:function(){
1908 - //update some local pointers for the selected source:
1909 - if( this.media_element.selected_source.duration != 0 )
 1907+ getDuration:function(){
 1908+ //update some local pointers for the selected source:
 1909+ if( this.media_element.selected_source.duration &&
 1910+ this.media_element.selected_source.duration != 0 ){
19101911 this.duration = this.media_element.selected_source.duration;
1911 - this.start_offset = this.media_element.selected_source.start_offset;
1912 - this.start_ntp = this.media_element.selected_source.start_ntp;
1913 - this.end_ntp = this.media_element.selected_source.end_ntp;
 1912+ this.start_offset = this.media_element.selected_source.start_offset;
 1913+ this.start_ntp = this.media_element.selected_source.start_ntp;
 1914+ this.end_ntp = this.media_element.selected_source.end_ntp;
 1915+ }else{
 1916+ //update start end_ntp if duration !=0 (set from plugin)
 1917+ if(this.duration && this.duration !=0){
 1918+ this.start_ntp = '0:0:0';
 1919+ this.end_ntp = seconds2ntp( this.duration );
 1920+ }
 1921+ }
19141922 //return the duration
19151923 return this.duration;
19161924 },
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_flashEmbed.js
@@ -1692,13 +1692,19 @@
16931693 if( ! this.monitorTimerId ){
16941694 if( $j('#'+this.id).length != 0 )
16951695 this.monitorTimerId = window.setInterval('$j(\'#'+_this.id+'\').get(0).monitor()', 250);
1696 - }
1697 - //set the start & end ntp
1698 - var end_ntp = (this.media_element.selected_source.end_ntp)?
1699 - this.media_element.selected_source.end_ntp : seconds2ntp(0);
1700 - var start_ntp = this.media_element.selected_source.start_ntp;
 1696+ }
17011697
17021698 var flash_state = this.fla.getStatus();
 1699+ //update the duration from the clip if its zero or not set:
 1700+ if( !this.duration || this.duration==0 ){
 1701+ if( this.fla.getClip() ){
 1702+ this.duration = this.fla.getClip().fullDuration;
 1703+ js_log('set duration via clip value: ' + this.getDuration() );
 1704+ }
 1705+ }
 1706+ //update the duration ntp values:
 1707+ this.getDuration();
 1708+
17031709 if( typeof flash_state == 'undefined' ){
17041710 var flash_state = {
17051711 "time" : this.fla.getTime()
@@ -1724,7 +1730,7 @@
17251731 }
17261732 }
17271733
1728 - if(this.currentTime > ntp2seconds(start_ntp) && !this.startedTimedPlayback){
 1734+ if(this.currentTime > ntp2seconds(this.start_ntp) && !this.startedTimedPlayback){
17291735 var fail = false;
17301736 try
17311737 {
@@ -1747,35 +1753,30 @@
17481754 js_log('flashEmbed: _local_ Seeking to ' + this.seek_time_sec);
17491755 this.fla.seek( this.seek_time_sec );
17501756 this.seek_time_sec = 0;
1751 - }
1752 -
1753 - //flash is giving bogus duration get from "this" (if available)
1754 - /*if(!this.media_element.selected_source.end_ntp && this.fla.getDuration()>0)
1755 - this.media_element.selected_source.setDuration(this.fla.getDuration());
1756 - */
 1757+ }
17571758
17581759 if(!this.userSlide){
1759 - if((this.currentTime - ntp2seconds(start_ntp)) < 0){
 1760+ if((this.currentTime - ntp2seconds(this.start_ntp)) < 0){
17601761 this.setStatus('buffering...');
17611762 this.fla.setVolume(0);
17621763 }else{
1763 - this.setStatus( seconds2ntp(this.currentTime) + '/' + end_ntp);
1764 - this.setSliderValue((this.currentTime - ntp2seconds(start_ntp)) / (ntp2seconds(end_ntp)-ntp2seconds(start_ntp)) );
 1764+ this.setStatus( seconds2ntp(this.currentTime) + '/' + this.end_ntp);
 1765+ this.setSliderValue((this.currentTime - ntp2seconds(this.start_ntp)) / (ntp2seconds(this.end_ntp)-ntp2seconds(this.start_ntp)) );
17651766 }
17661767 }
17671768
17681769 //checks to see if we reached the end of playback:
1769 - if(this.startedTimedPlayback &&
1770 - ( this.currentTime > (ntp2seconds(end_ntp)+1)
 1770+ if(this.duration && this.startedTimedPlayback &&
 1771+ ( this.currentTime > (ntp2seconds(this.end_ntp)+1)
17711772 ||
1772 - ( this.currentTime > (ntp2seconds(end_ntp)-1)
 1773+ ( this.currentTime > (ntp2seconds(this.end_ntp)-1)
17731774 && this.prevTime == this.currentTime) )
17741775 ){
1775 - js_log('probally reached end of stream: '+this.currentTime);
 1776+ js_log('prbally reached end of stream: '+this.currentTime);
17761777 this.onClipDone();
17771778 }
17781779 this.prevTime = this.currentTime;
1779 - //js_log('cur perc loaded: ' + this.fla.getPercentLoaded() +' cur time : ' + (this.currentTime - ntp2seconds(start_ntp)) +' / ' +(ntp2seconds(end_ntp)-ntp2seconds(start_ntp)));
 1780+ //js_log('cur perc loaded: ' + this.fla.getPercentLoaded() +' cur time : ' + (this.currentTime - ntp2seconds(this.start_ntp)) +' / ' +(ntp2seconds(this.end_ntp)-ntp2seconds(this.start_ntp)));
17801781 },
17811782 // get the embed fla object
17821783 getFLA : function (){

Status & tagging log