Revision: 43500
Author:   dale
Date:     2008-11-14 19:44:42 +0000 (Fri, 14 Nov 2008)

Log Message:
-----------
* sequence editor style and functional updates
  * multi-clip-select & removal with key bindings (shift, delete)
* fixes for time display of vlc playback of mp4 streams
* maintenance updates for archive.org stream updates
* minor security updates removed an accidental entry point in maintenance

Modified Paths:
--------------
    trunk/extensions/MetavidWiki/maintenance/maintenance_util.inc.php
    trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php
    trunk/extensions/MetavidWiki/maintenance/mv_oneTime_fixes.php
    trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.inc.php
    trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.php
    trunk/extensions/MetavidWiki/maintenance/simple_cron.php
    trunk/extensions/MetavidWiki/maintenance/transcode_to_flv.php
    trunk/extensions/MetavidWiki/maintenance/tv2mvWiki/README
    trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_flashEmbed.js
    trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_htmlEmbed.js
    trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_vlcEmbed.js
    
trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_playlists.php
    trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
    trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js
    trunk/extensions/MetavidWiki/skins/mv_embed/mv_sequencer.js
    trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/mv_sequence.css
    trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/styles.css

Modified: trunk/extensions/MetavidWiki/maintenance/maintenance_util.inc.php
===================================================================
--- trunk/extensions/MetavidWiki/maintenance/maintenance_util.inc.php   
2008-11-14 19:11:52 UTC (rev 43499)
+++ trunk/extensions/MetavidWiki/maintenance/maintenance_util.inc.php   
2008-11-14 19:44:42 UTC (rev 43500)
@@ -12,7 +12,7 @@
  *
  * Maintenance Utility Functions:
  */
-
+require_once ( '../../../maintenance/commandLine.inc' );
  /*
  * set up the bot user:
  */

Modified: trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php
===================================================================
--- trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php     
2008-11-14 19:11:52 UTC (rev 43499)
+++ trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php     
2008-11-14 19:44:42 UTC (rev 43500)
@@ -458,18 +458,16 @@
 
 // given a stream name it pulls all metavid stream data and builds semantic 
wiki page
 function mv_semantic_stream_desc( & $mvTitle, & $stream ) {
-       global $start_time, $end_time;
+       global $start_time, $end_time;  
        /*$sql = "SELECT * FROM `metavid`.`streams` WHERE `name` LIKE '" . 
$mvTitle->getStreamName() . "'";
        $dbr = wfGetDB(DB_SLAVE);
        $res = $dbr->query($sql);
        //echo "\n" . $sql . "\n";
        $stream = $dbr->fetchObject($res);*/
        $stream_id = $stream->id;
-       $out = '';
-       $pout = mv_proccess_attr( 'stream_attr_varchar', $stream_id );
-       $pout .= mv_proccess_attr( 'stream_attr_int', $stream_id );
-       // add links/generic text at the start
-       $out .= '==Official Record==' . "\n";
+       $out = '';      
+       
+       // add links/generic text at the start  
        $date = date( 'Ymd', $start_time );
        $cspan_date = date( 'Y-m-d', $start_time );
        $ch_type = '';
@@ -478,6 +476,7 @@
        if ( strpos( $mvTitle->getStreamName(), 'senate' ) !== false )
                $ch_type = 's';
        if ( $ch_type != '' ) {
+               $out .= '==Official Record==' . "\n";
                $out .= 
'*[http://www.govtrack.us/congress/recordindex.xpd?date=' . $date .
                '&where=' . $ch_type .
                ' GovTrack Congressional Record]' . "\n\n";
@@ -486,40 +485,65 @@
                $out .= 
'*[http://thomas.loc.gov/cgi-bin/query/B?r110:@FIELD(FLD003+' . $ch_type . 
')[EMAIL PROTECTED](DDATE+' . $date . ')' .
                ' THOMAS Extension of Remarks]' . "\n\n";
        }
+       $dbw = wfGetDB( DB_WRITE );
+       
+       //clear out existing archive.org files for the current stream           
        
+       $sql = "DELETE FROM  `mv_stream_files` WHERE 
`stream_id`='{$stream->id}' AND `file_desc_msg` LIKE 'ao_file_%' LIMIT 10";
+       $dbw->query( $sql );
+       print "removed existing archive.org files for $stream->name \n";
+                       
        if ( $stream->archive_org != '' ) {
                // grab file list from archive.org:
                require_once( 'scrape_and_insert.inc.php' );
                $aos = new MV_ArchiveOrgScrape();
+               
                $file_list = $aos->getFileList( $stream->name );
+               if($file_list===false || count($file_list)==0) {
+                       print 'no files on archive.org for'. $stream->name 
."\n\n";
+                       return '';
+               }
                $out .= '==More Media Sources==' . "\n";
                // all streams have congretional cronical:
                $out .= 
'*[http://www.c-spanarchives.org/congress/?q=node/69850&date=' . $cspan_date . 
'&hors=' . $ch_type .
                ' CSPAN\'s Congressional Chronicle]' . "\n";
                
-               if ( $file_list ) {
+               if ( $file_list ) {                                     
                        $out .= '*[http://www.archive.org/details/mv_' . 
$stream->name . 
-                       ' Archive.org hosted original copy]' . "\n";
+                       ' Archive.org hosted version]' . "\n";
                        // also output 'direct' semantic links to alternate 
file qualities:
-                       $out .= "\n===Full File Links===\n";
-                       $dbw = wfGetDB( DB_WRITE );
+                       $out .= "\n===Full File Links===\n";            
+                       $found_ogg=false;
                        foreach ( $file_list as $file ) {
                                $name = str_replace( ' ', '_', $file[2] );
-                               $url = $file[1];
-                               $size = $file[3];
-                               $out .= "*[[ao_file_{$name}:={$url}|$name]] 
{$size}\n";
-
+                               $url = 'http://archive.org'.$file[1];
+                               $size = $file[3];               
+                                                                               
                                // add these files into the mv_files table:
-                               // @@todo future we should tie the mv_files 
table to the semantic properties?
+                               // @@todo in the future we should tie the 
mv_files table to the semantic properties.
                                // check if already present:
+                               
                                $quality_msg = 'ao_file_' . $name;
+                               
+                               if($name=='Ogg_Video'){
+                                       $found_ogg=true;
+                               }
                                $path_type = 'url_file';
+                               if($found_ogg && $name=='512Kb_MPEG4'){
+                                       $quality_msg = 'mv_archive_org_mp4';
+                                       $path_type = 'mp4_stream';
+                               }
+                               //print "found ogg $found_ogg name: $name  
qm:$quality_msg\n";
+
+                               //output stream to wiki text: 
+                               $out .= "*[{$url} $name] {$size}\n";    
+                               
                                $dbr = wfGetDB( DB_SLAVE );
                                $res = $dbr->query( "SELECT * FROM 
`mv_stream_files`
                                                WHERE 
`stream_id`={$mvTitle->getStreamId()}
                                                AND 
`file_desc_msg`='{$quality_msg}'" );
                                if ( $dbr->numRows( $res ) == 0 ) {
-                                       $sql = "INSERT INTO `mv_stream_files` 
(`stream_id`, `file_desc_msg`, `path_type`, `path`)" .
-                                       " VALUES ('{$mvTitle->getStreamId()}', 
'{$quality_msg}', '{$path_type}','{$url}' )";
+                                       $sql = "INSERT INTO `mv_stream_files` 
(`stream_id`,`duration`, `file_desc_msg`, `path_type`, `path`)" . 
+                                       " VALUES 
('{$mvTitle->getStreamId()}','{$mvTitle->getDuration()}', '{$quality_msg}', 
'{$path_type}','{$url}' )";
                                } else {
                                        $row = $dbr->fetchObject( $res );
                                        // update that msg key *just in case*
@@ -530,27 +554,33 @@
                        $dbw->commit();
                        // more semantic properties
                        $out .= "\n\n";
-                       $out .= $pout;
-                       $out .= '[[stream_duration:=' . ( $end_time - 
$start_time ) . '| ]]' . "\n";
+                       $out .= '[[stream_duration::' . ( $end_time - 
$start_time ) . '| ]]' . "\n";
                        if ( $stream->org_start_time ) {
-                               $out .= '[[original_date:=' . 
$stream->org_start_time . '| ]]';
+                               $out .= '[[original_date::' . 
$stream->org_start_time . '| ]]';
                        }
                }
        }
        // add stream category (based on sync status)
-       switch( $stream->sync_status ) {
-               case 'not_checked':
-                       $out .= "\n\n" . '[[Category:Stream Unchecked]]';
-               break;
-               case 'impossible':
-                       $out .= "\n\n" . '[[Category:Stream Out of Sync]]';
-               break;
-               case 'in_sync':
-                       $out .= "\n\n" . '[[Category:Stream Basic Sync]]';
-                       // other options [stream high quality sync ];
-               break;
+       //(only add if the wiki page does not exist)
+       $wStreamTitle = Title::newFromText($stream->name, MV_NS_STREAM);
+       if( !$wStreamTitle->exists() ) {
+               switch( $stream->sync_status ) {
+                       case 'not_checked':
+                               $out .= "\n\n" . '[[Category:Stream 
Unchecked]]';
+                       break;
+                       case 'impossible':
+                               $out .= "\n\n" . '[[Category:Stream Out of 
Sync]]';
+                       break;
+                       case 'in_sync':
+                               $out .= "\n\n" . '[[Category:Stream Basic 
Sync]]';
+                               // other options [stream high quality sync ];
+                       break;
+               }
        }
-
+       // add in semantic stream properties
+       //$out = mv_proccess_attr( 'stream_attr_varchar', $stream_id );
+       //$out .= mv_proccess_attr( 'stream_attr_int', $stream_id );
+       
        return $out;
 }
 function do_bill_insert( $bill_key ) {

Modified: trunk/extensions/MetavidWiki/maintenance/mv_oneTime_fixes.php
===================================================================
--- trunk/extensions/MetavidWiki/maintenance/mv_oneTime_fixes.php       
2008-11-14 19:11:52 UTC (rev 43499)
+++ trunk/extensions/MetavidWiki/maintenance/mv_oneTime_fixes.php       
2008-11-14 19:44:42 UTC (rev 43500)
@@ -16,6 +16,7 @@
 actions: 
        strip_speech_by  //strips extra speech by text
        update_stream_desc //updates stream desc
+       update_archive_org_files //updates pointers to archive.org mp4 streaming
 
 EOT;
        exit ();
@@ -32,7 +33,42 @@
        case 'update_stream_desc':
                update_stream_desc();
        break;
+       case 'update_archive_org_files':
+               run_archive_org_update();
+       break;
 }
+function run_archive_org_update(){
+       //first get all the streams:                    
+       include_once( 'metavid2mvWiki.inc.php' );
+       $dbr = wfGetDB( DB_READ );
+       $dbw = wfGetDB( DB_WRITE );
+       
+       $sql = "SELECT * FROM `mv_streams` LIMIT 0, 5000";      
+       $result = $dbr->query( $sql );  
+       while ( $stream = $dbr->fetchObject( $result ) ) {
+               //get the wiki page:
+               $streamTitle = Title::newFromText($stream->name, MV_NS_STREAM);
+               $mArticle = new Article( $streamTitle ); 
+               $mvTitle = new MV_Title($stream->name); 
+               $stream->archive_org = true;
+               $out = mv_semantic_stream_desc($mvTitle, $stream);      
+                               
+               if(trim($out)!=''){
+                       //get all the existing cats:
+                       $wtext = $mArticle->getContent();
+                       preg_match_all('/Category\:([^\]]*)/',$wtext, $matches);
+                       if( isset($matches[1]) ){
+                               foreach($matches[1] as $category){
+                                       $out.="\n[[Category:{$category}]]";
+                               }
+                       }
+                       //now that we keept categories force update the page:   
                
+                       do_update_wiki_page( $streamTitle, $out, MV_NS_STREAM, 
$force = true );
+                       
+               }
+       }
+}
+
 function update_stream_desc(){
        /*==Official Record==
 *[[GovTrack]] Congressional 
Record[http://www.govtrack.us/congress/recordindex.xpd?date=20080609&where=h]
@@ -70,9 +106,7 @@
                $cur_text=preg_replace('/\*\[\[CSPAN\]\]\'s Congressional 
Chronicle \[([^\[]*)\]/','*[$1 CSPAN Congressional Chronicle]', $cur_text);
                //do force update
                do_update_wiki_page( $streamTitle, $cur_text, MV_NS_STREAM, 
$force = true );
-       }
-       
-       
+       }               
        //update links
 }
 

Modified: trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.inc.php
===================================================================
--- trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.inc.php  
2008-11-14 19:11:52 UTC (rev 43499)
+++ trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.inc.php  
2008-11-14 19:44:42 UTC (rev 43500)
@@ -819,8 +819,14 @@
 
 class MV_ArchiveOrgScrape extends MV_BaseScraper {
        function getFileList( $stream_name ) {
-               $raw_page = $this->doRequest( 
'http://www.archive.org/details/mv_' . $stream_name );
-               preg_match_all( 
'/href="(http:\/\/www.archive.org\/download\/mv_[^"]*)">([^<]*)<\/a>([^<]*)/', 
$raw_page, $matches );
+               //get the latest archive.org page: 
+               $raw_page = $this->doRequest( 
'http://www.archive.org/details/mv_' . $stream_name, array(), $get_fresh=true );
+               if($raw_page=='')
+                       return false;
+               //print "Raw page: $raw_page";
+               
+               preg_match_all( 
'/href="(\/download\/mv_[^"]*)">([^<]*)<\/a>([^<]*)/', $raw_page, $matches );
+               
                $files = array();
                if ( isset( $matches[1] ) ) {
                        foreach ( $matches as $inx => $set ) {
@@ -828,10 +834,16 @@
                                        $files[$k][$inx] = trim( $v );
                                }
                        }
-                       // add the flv:
-                       $files[] = array( '',
-                                        'http://www.archive.org/download/mv_' 
. $stream_name . '/' . $stream_name . '.flv',
-                                        'flash flv', '' );
+                       //remove duplicates
+                       $orgFiles = $files;
+                       $files = array();
+                       $dupCheck=array();
+                       foreach( $orgFiles as $file ){
+                               if( !isset($dupCheck[ $file[1] ] )){
+                                       $files[] = $file;
+                                       $dupCheck[ $file[1] ] = true; 
+                               }
+                       }
                } else {
                        return false;
                }
@@ -840,12 +852,13 @@
 }
 
 class MV_BaseScraper {
+       var $number_of_tries = 1;
        /*
         * simple url cach using the mv_url_cache table
         *
         * @@todo handle post vars
         */
-       function doRequest( $url, $post_vars = array() ) {
+       function doRequest( $url, $post_vars = array(), $get_fresh=false, 
$try_count=1 ) {
                $dbr = wfGetDB( DB_SLAVE );
                $dbw = wfGetDB( DB_MASTER );
                // check the cache
@@ -853,14 +866,19 @@
                // select( $table, $vars, $conds='', $fname = 
'Database::select', $options = array() )
                $res = $dbr->select( 'mv_url_cache', '*', array( 'url' => $url 
), 'MV_BaseScraper::doRequest' );
                // @@todo check date for experation
-               if ( $res->numRows() == 0 ) {
-                       echo "do web request: " . $url . "\n";
+               if ( $res->numRows() == 0 || $get_fresh) {
+                       echo "do web request: " . $url . "\n";                  
                        // get the content:
                        $page = file_get_contents( $url );
                        if ( $page === false ) {
-                               echo( "error retriving $url retrying...\n" );
-                               sleep( 5 );
-                               return $this->doRequest( $url );
+                               echo( "error getting url retrying 
(".$try_count." of $this->number_of_tries)" );
+                               sleep( 2 );
+                               if($try_count >= $this->number_of_tries){
+                                       print "could not get url after 
$this->number_of_tries \n\n";
+                                       return '';
+                               }                               
+                               $try_count++;
+                               return $this->doRequest( $url, $post_vars, 
$get_fresh, $try_count );
                        }
                        if ( $page != '' ) {
                                // insert back into the db:

Modified: trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.php
===================================================================
--- trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.php      
2008-11-14 19:11:52 UTC (rev 43499)
+++ trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.php      
2008-11-14 19:44:42 UTC (rev 43500)
@@ -10,7 +10,7 @@
  * @url http://metavid.ucsc.edu
  */
 
- $cur_path = $IP = dirname( __FILE__ );
+$cur_path = $IP = dirname( __FILE__ );
  // include commandLine.inc from the mediaWiki maintenance dir:
 require_once( '../../../maintenance/commandLine.inc' );
 require_once( 'maintenance_util.inc.php' );

Modified: trunk/extensions/MetavidWiki/maintenance/simple_cron.php
===================================================================
--- trunk/extensions/MetavidWiki/maintenance/simple_cron.php    2008-11-14 
19:11:52 UTC (rev 43499)
+++ trunk/extensions/MetavidWiki/maintenance/simple_cron.php    2008-11-14 
19:44:42 UTC (rev 43500)
@@ -1,4 +1,9 @@
 <?php
+//should only be run from the command line: 
+if ( php_sapi_name() != 'cli' ) {
+    print "This script must be run from the command line\n";
+    exit( 1 );
+}
 $i=0;
 while(true){
        echo "run update search index:\n";

Modified: trunk/extensions/MetavidWiki/maintenance/transcode_to_flv.php
===================================================================
--- trunk/extensions/MetavidWiki/maintenance/transcode_to_flv.php       
2008-11-14 19:11:52 UTC (rev 43499)
+++ trunk/extensions/MetavidWiki/maintenance/transcode_to_flv.php       
2008-11-14 19:44:42 UTC (rev 43500)
@@ -8,16 +8,17 @@
        if running locally just link it ie on mvbox2:
        ln -s /metavid/video_archive /media/mv_ssh_flvMediaStorage 
 */
-$mvMountedSource = '/media/mv_ssh_oggMediaStorage/';
-//mvbox2.cse.ucsc.edu
-$mvMountedDest  = '/media/mv_ssh_flvMediaStorage/';
 
 //include commandLine.inc from the mediaWiki maintance dir: 
 require_once ('../../../maintenance/commandLine.inc');
-
 //for generate flv metadata:
 include_once('../skins/mv_embed/flvServer/MvFlv.php');
 
+
+$mvMountedSource = '/media/mv_ssh_oggMediaStorage/';
+//mvbox2.cse.ucsc.edu
+$mvMountedDest  = '/media/mv_ssh_flvMediaStorage/';
+
 define('MV_BASE_MEDIA_SERVER_PATH', 
'http://mvbox2.cse.ucsc.edu/mvFlvServer.php/');
 //ffmpeg based (bad)
 //$flvEncodeCommand = 'ffmpeg -i $input -ar 22050 -async 2 -aspect 4:3 -f flv  
-acodec libmp3lame -ac 1 -ab 32k -b 250k -s 400x300 $output';

Modified: trunk/extensions/MetavidWiki/maintenance/tv2mvWiki/README
===================================================================
--- trunk/extensions/MetavidWiki/maintenance/tv2mvWiki/README   2008-11-14 
19:11:52 UTC (rev 43499)
+++ trunk/extensions/MetavidWiki/maintenance/tv2mvWiki/README   2008-11-14 
19:44:42 UTC (rev 43500)
@@ -1,15 +1,11 @@
 This will eventually host the tools for capturing brodcasted content
-and insertting it into a wiki
+and inserting it into a wiki/ uploading it to archive.org
 
-presently the script metavid project uses are accesible here:
+presently the script metavid project uses are accessible here:
 http://slugforge.cse.ucsc.edu/gf/project/metavid/
-but I don't recomend using them not genneraly applicable.
+but I don't recommend using them not generally applicable.
 
 
-
-The genneral flow and machine layout should be as follows:
-note: obvisuly your layout may differ and adjustments may be needed.
-
 dependencies:
        metavidWiki
        ffmpeg2theora

Modified: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_flashEmbed.js
===================================================================
--- trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_flashEmbed.js      
2008-11-14 19:11:52 UTC (rev 43499)
+++ trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_flashEmbed.js      
2008-11-14 19:44:42 UTC (rev 43500)
@@ -1636,13 +1636,7 @@
        this.getFLA();
        this.parent_pause();
        if(this.fla['pause'])
-               this.fla.pause();       
-               //stop updates: 
-               if( this.monitorTimerId != 0 )
-           {
-               clearInterval(this.monitorTimerId);
-               this.monitorTimerId = 0;
-           }
+               this.fla.pause();                       
     },
     monitor : function()
     {    

Modified: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_htmlEmbed.js
===================================================================
--- trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_htmlEmbed.js       
2008-11-14 19:11:52 UTC (rev 43499)
+++ trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_htmlEmbed.js       
2008-11-14 19:44:42 UTC (rev 43500)
@@ -77,8 +77,8 @@
                return true;
        },
        renderTimelineThumbnail:function( options ){
-               //generate a scaled down version _that_ we can clone if 
nessisary 
-               //add a not visiable container to the body:             
+               //generate a scaled down version _that_ we can clone if 
nessisary  
+               //add a not vissiable container to the body:            
                var do_refresh = (typeof options['refresh'] != 
'undefined')?true:false;
                
                var thumb_render_id =   this.id +'_thumb_render_'+ 
options.height;
@@ -91,8 +91,8 @@
                        var thumb_class = (typeof options['thumb_class'] 
!='undefined')? options['thumb_class'] : '';
                        
                        $j('body').append( '<div id="' + thumb_render_id + '" 
style="display:none">'+
-                                                                       '<div 
class="' + thumb_class + '" style="display:block;border:solid thin black;'+
-                                                                       
'width:'+options.width+'px;height:'+options.height+'px;overflow:hidden;" >'+    
                                                                
+                                                                       '<div 
class="' + thumb_class + '" '+ 
+                                                                       
'style="width:'+options.width+'px;height:'+options.height+'px;" >'+             
                                                        
                                                                                
        this.getThumbnailHTML() + 
                                                                        
'</div>'+
                                                          '</div>' 

Modified: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_vlcEmbed.js
===================================================================
--- trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_vlcEmbed.js        
2008-11-14 19:11:52 UTC (rev 43499)
+++ trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_vlcEmbed.js        
2008-11-14 19:44:42 UTC (rev 43500)
@@ -211,7 +211,12 @@
                this.duration = this.vlc.input.length /1000;   
        }*/     
                //update the currentTime attribute 
-               this.currentTime =this.vlc.input.time/1000;             
+                if( this.media_element.selected_source.timeFormat =='anx' ){
+               this.currentTime = this.vlc.input.time/1000;
+               //js_log('set buffer: ' + flash_state.bufferEnd + ' at time: ' 
+ flash_state.time +' of total dur: ' + this.getDuration()); 
+        }else{
+               this.currentTime = (this.vlc.input.time/1000) + 
this.media_element.selected_source.start_offset;       
+        }                      
         if( this.duration > 0 || this.vlc.input.time > 0){                     
                                                                                
                        
this.start_offset=this.media_element.selected_source.start_offset;              
                        

Modified: 
trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_playlists.php
===================================================================
--- 
trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_playlists.php  
    2008-11-14 19:11:52 UTC (rev 43499)
+++ 
trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_playlists.php  
    2008-11-14 19:44:42 UTC (rev 43500)
@@ -45,7 +45,7 @@
                                '<br>' .
                                '<iframe width="500" height="200" src="' . 
$smilURL . '">rss feed here</iframe>';
 
-$smilURL = 'http://localhost/wiki/index.php/Special:MvExportSequence/Test';
+$smilURL = 
'http://'.$_SERVER['SERVER_NAME'].'/wiki/index.php/Special:MvExportSequence/Test';
 $sample_embed[9]['tag'] = '<playlist src="' . $smilURL . '" />';
 $sample_embed[9]['desc'] = ' <br><b>MediaWiki example:</b><br/>'.
                                '<br>' .

Modified: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
===================================================================
--- trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js     2008-11-14 
19:11:52 UTC (rev 43499)
+++ trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js     2008-11-14 
19:44:42 UTC (rev 43500)
@@ -2234,7 +2234,7 @@
                var etime_parts = times[1].split(':');
                
                var new_anno_track_url = annoURL.protocol +'://'+ annoURL.host 
+ annoURL.path +'?';
-               for(i in annoURL.queryKey){
+               for(var i in annoURL.queryKey){
                        new_anno_track_url 
+=(i=='t')?'t='+new_start+'/'+new_end +'&' :
                                                                         i+'='+ 
annoURL.queryKey[i]+'&';                                                        
                }               
@@ -2461,9 +2461,13 @@
                        my_thumb_src = getUpdateTimeURL( my_thumb_src, 
time_ntp, options.size );
                }
                var thumb_class = (typeof options['thumb_class'] 
!='undefined')? options['thumb_class'] : '';
-               return '<img class="' + thumb_class + '" src="' + my_thumb_src 
+'" '+
+               return '<div class="' + thumb_class + '" src="' + my_thumb_src 
+'" '+
                                'style="height:' + options.height + 'px;' +
-                               'width:' + options.width + 'px" >';
+                               'width:' + options.width + 'px" >' + 
+                                       '<img src="' + my_thumb_src +'" '+
+                                               'style="height:' + 
options.height + 'px;' +
+                                               'width:' + options.width + 
'px">' +
+                               '</div>';
        },
        updateThumbTime:function( float_sec ){
                var _this = this;                                               
                                                        
@@ -2820,7 +2824,7 @@
         *      there is no general way to pause the video
         *  must be overwritten by embed object to support this functionality.
         */
-       pause : function(){
+       pause: function(){
                 js_log('mv_embed:do pause');
                 var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
          //(playing) do pause          
@@ -2828,7 +2832,7 @@
          //update "paused state"               
          $j("#mv_play_pause_button_"+this_id).attr('class', 'play_button');
        },      
-       play_or_pause : function(){
+       play_or_pause: function(){
                js_log('embed:f:play_or_pause');
         //check state and set play or pause
         if(this.paused){

Modified: trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js
===================================================================
--- trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js  2008-11-14 
19:11:52 UTC (rev 43499)
+++ trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js  2008-11-14 
19:44:42 UTC (rev 43500)
@@ -547,6 +547,8 @@
                $j('#clipDesc_'+this.cur_clip.id).hide();                       
                this.cur_clip=new_clip;                 
                $j('#clipDesc_'+this.cur_clip.id).show();
+               //update the playhead: 
+               this.setSliderValue( this.cur_clip.dur_offset / 
this.getDuration() );           
        },
        prev: function(){
                //advance the playhead to the previous clip                     
@@ -715,19 +717,13 @@
                        var pwidth = Math.round( perc * _this.track_len);
                        //var pwidth = Math.round( perc  * _this.track_len - 
(_this.mv_seeker_width*perc) );
                        
-                       var barHtml = '<div id="cl_status_'+clip.id+'"  
style="' +
-                                       'position:absolute;' + 
+                       var barHtml = '<div id="cl_status_'+clip.id+'" 
class="cl_status"  style="' +                                    
                                        'left:'+cur_pixle +'px;'+
-                                       'width:'+pwidth + 'px;'+
-                                       'height:12px;'+
-                                       'top:0px;'+
-                                       'z-index:1;';
+                                       'width:'+pwidth + 'px;';                
                        
                        //set left or right border based on track pos 
                        barHtml+=( i == _this.default_track.getClipCount()-1 )?
                                 'border-left:solid thin black;':
-                                'border-right:solid thin black;';
-                               
-                                                       
+                                'border-right:solid thin black;';              
                                                                        
                        barHtml+= 'filter:alpha(opacity=40);'+
                                        '-moz-opacity:.40;">'
                                        '</div>';

Modified: trunk/extensions/MetavidWiki/skins/mv_embed/mv_sequencer.js
===================================================================
--- trunk/extensions/MetavidWiki/skins/mv_embed/mv_sequencer.js 2008-11-14 
19:11:52 UTC (rev 43499)
+++ trunk/extensions/MetavidWiki/skins/mv_embed/mv_sequencer.js 2008-11-14 
19:44:42 UTC (rev 43500)
@@ -69,7 +69,6 @@
        
        base_adj_duration:.5, //default time to subtract or add when adjusting 
clips.   
        
-       
        //Msg are all the language specific values ... 
        // (@@todo overwrite by msg values preloaded in the page)       
        //tack/clips can be pushed via json or inline playlist format
@@ -95,6 +94,7 @@
                'options':0
                //menu_resource_overview
        },      
+       multi_clip_select:false, //controls the multi-clip select state
        init:function( initObj ){       
                //set the default values:
                for(var i in sequencerDefaultValues){
@@ -189,7 +189,7 @@
                        req_url+='|'+i;
                        $j('#'+i+'_ic').html( getMsg('loading_txt') );//set 
targets to loading
                }                               
-               var _this = this;
+               var this_seq = this;
                do_request(req_url, function(data){
                        if(typeof data=='string'){
                                js_log(' eval data: ' + data);                  
                
@@ -199,12 +199,12 @@
                        for(var i in data){
                                js_log('set '+ i + ' to: '+ data[i] );
                                $j('#'+i+'_ic').html( data[i] );
-                               _this.doMenuItemDispJs(i)
+                               this_seq.doMenuItemDispJs(i)
                        }
                });                                             
        },
        doMenuItemDispJs:function(item){                
-               var _this = this;
+               var this_seq = this;
                var target_id = item + '_ic';
                //do any menu item post embed js hook processing:
                switch(item){           
@@ -220,9 +220,9 @@
                                        return js_log( 'Error:missing 
interface_url, can not load search interface' );
                                                                                
                                                                                
                                                
                                
mvJsLoader.doLoad({'mvRemoteSearch':'mv_remote_media_search.js'}, function(){   
                                
-                                       _this.mySearch = new mvRemoteSearch( {
-                                               'p_seq':_this,
-                                               'instance_name': 
_this.instance_name + '.mySearch',
+                                       this_seq.mySearch = new mvRemoteSearch( 
{
+                                               'p_seq':this_seq,
+                                               'instance_name': 
this_seq.instance_name + '.mySearch',
                                                'target_input':'mv_ams_search',
                                                'target_submit':'mv_ams_submit',
                                                
'target_results':'mv_ams_results'
@@ -231,15 +231,15 @@
                        break;                  
                        case 'options':                                         
        
                                $j('#'+target_id+" 
input[value='simple_editor']").attr({
-                                       
'checked':(_this.timeline_mode=='clip')?true:false                              
        
+                                       
'checked':(this_seq.timeline_mode=='clip')?true:false                           
        
                                }).click(function(){
-                                       _this.doSimpleTl();
+                                       this_seq.doSimpleTl();
                                });
                                $j('#'+target_id+" 
input[value='advanced_editor']").attr({
-                                       
'checked':(_this.timeline_mode=='time')?true:false                              
        
-                               }).click(function(){                            
        
-                                       _this.doAdvancedTl();
-                               });                                             
+                                       'checked':( 
this_seq.timeline_mode=='time' )?true:false                                 
+                               }).click(function(){
+                                       this_seq.doAdvancedTl();
+                               });
                        break;
                }
        },
@@ -325,8 +325,7 @@
                                );
                                //also render the clips in the trackset 
container: (thumb or text view)
                                $j('#'+this.timeline_id+'_tracks').append(
-                                       '<div id="container_track_'+i+'" 
style="top:'+top_pos+'px;height:'+(track_height+2)+'px;left:0px;right:0px;" 
class="container_track">' +                                        
-                                       '</div>'
+                                       '<div id="container_track_'+i+'" 
style="top:'+top_pos+'px;height:'+(track_height+2)+'px;left:0px;right:0px;" 
class="container_track" />'
                                );              
                                top_pos+=track_height+20;               
                        }                                       
@@ -338,7 +337,7 @@
                                var track_height=this.track_clipThumb_height;
                                //add in play box and container tracks
                                $j('#'+this.timeline_id).append(''+
-                                       '<div id="container_track_'+i+'" 
style="position:absolute;top:20px;height:'+(track_height+20)+'px;left:10px;right:0px;"
 class="container_track">' +                                     
+                                       '<div id="container_track_'+i+'" 
style="position:absolute;top:25px;height:'+(track_height+30)+'px;left:10px;right:0px;"
 class="container_track">' +                                     
                                        '</div>'
                                );
                                top_pos+=track_height+20;
@@ -391,6 +390,35 @@
                //render the timeline                                   
                this.renderTimeLine();                  
                this.do_refresh_timeline();
+               
+               var this_seq = this;
+               //set up key bidnings
+               $j().keyup(function (e) {
+                       js_log('pressed: ' + e.which);
+                       //delete key (remove selected clips) (in the future we 
should take app state into consideration) 
+                       if( e.which == 8 ){
+                               var remove_clip_ary=new Array();
+                               //remove selected clips from display
+                               $j('.container_track 
.mv_selected_clip').each(function(){                                       
+                                       //grab the track index from the id 
(assumes track_#_clip_#                                      
+                                       remove_clip_ary.push ( 
$j(this).parent().attr('id').replace('track_','').replace('clip_','').split('_')
 );                                                                             
                                                                                
 
+                               });                             
+                               this_seq.removeClips( remove_clip_ary );        
+                       }
+               });             
+               $j().keydown(function(e){
+                       js_log('pushed down on:' + e.which);
+                       //if user pressed "shift" enable multi-select 
+                       if( e.which == 16 ){
+                               this_seq.multi_clip_select = true;
+                       }
+               });
+               $j().keyup(function(e){
+                       js_log('key up on ' + e.which);
+                       if( e.which == 16 ){
+                               this_seq.multi_clip_select = false;
+                       }
+               });
        },
        update_tl_hook:function(jh_time_ms){                    
                //put into seconds scale: 
@@ -528,28 +556,27 @@
                $j('#modal_window').hide();
                $j('#modalbox').show();
        },
-       removeClip:function(track_inx, clip_inx){
-               //fade out fast: 
+       removeClips:function( remove_clip_ary ){                
+               //js_log('remove t:' + track_inx + ' c:'+ clip_inx + ' id:' +' 
#track_'+track_inx+'_clip_'+clip_inx);   
                var this_seq = this;
-               
$j('#track_'+track_inx+'_clip_'+clip_inx).fadeOut("fast",function(){
-                       this_seq.plObj.tracks[track_inx].clips.splice(clip_inx, 
1);
-                       //reorder:
-                       for( var k in this_seq.plObj.tracks[track_inx].clips){
-                               if(typeof 
this_seq.plObj.tracks[track_inx].clips[i]!= 'undefined'){
-                                       
this_seq.plObj.tracks[track_inx].clips[i].order=k;
-                               }
-                       }
+               var jselect = coma ='';         
+               $j.each( remove_clip_ary, function(inx, track_clip){
+                       //remove the clips from the base library
+                       this_seq.plObj.tracks[ track_clip[0] ].clips.splice( 
track_clip[1], 1);
+                       jselect+= coma + '#track_' + track_clip[0] + '_clip_' + 
track_clip[1];
+                       coma=',';
+               });
+               //animate the removal           
+               $j(jselect).fadeOut("slow", function(){
                        //re-render tracks: 
-                       this_seq.render_tracks( track_inx );                    
-                       
-                       if(this_seq.plObj.tracks[track_inx].clips.length==0){
-                               this_seq.plObj.getHTML();
-                       }else{
-                               //update playlist desc:
-                               this_seq.plObj.pl_duration=null;
-                               this_seq.plObj.updateTitle();   
-                       }
-               });     
+                       this_seq.do_refresh_timeline();
+               });                             
+               //reorder:
+               //for( var k in this_seq.plObj.tracks[track_inx].clips){
+               //      if(typeof this_seq.plObj.tracks[track_inx].clips[i] != 
'undefined'){
+               //              
this_seq.plObj.tracks[track_inx].clips[i].order=k;
+               //      }
+               //}     
        },
        doEdit:function( editObj ){
                //add the current editObj to the edit stack (should allow for 
"undo")
@@ -651,11 +678,10 @@
                                                clip.width_px = container_width;
                                                var base_id = 
'track_'+track_id+'_clip_'+j;
                                                track_html+='<span 
id="'+base_id+'" '+
-                                                                               
'class="mv_time_clip mv_clip_drag" '+  
-                                                                               
'style="'+
-                                                                               
'border:none;'+ 
+                                                                               
'class="mv_storyboard_container mv_clip_drag" '+  
+                                                                               
'style="'+                                                                      
        
                                                                                
'left:'+clip.left_px+'px;'+                                                     
                
-                                                                               
'height:' + (this.track_clipThumb_height+20) + 'px;' +                          
                                                                                
                                                
+                                                                               
'height:' + (this.track_clipThumb_height+30) + 'px;' +                          
                                                                                
                                                
                                                                                
'width:'+(container_width)+'px;" >';                                            
                                                                                
                                                
track_html+=clip.embed.renderTimelineThumbnail({
                                                                                
'width':frame_width,
@@ -670,10 +696,10 @@
                                                track_html+='<div style="" 
id="tb_' + base_id + '" class="clip_trans_box"/>';
                                                
                                                //render out adjustment text
-                                               track_html+='<div id="' + 
base_id + '_adj' + '" 
style="font-size:small;color:#6F6;display:none;position:absolute;top:'+ 
(this.track_clipThumb_height+10 )+'px;>'+
-                                                                               
'<span onClick="'+this.instance_name+'.adjClipDur(' + track_id + ',' + j + 
',\'-\')" /> - </span>'+
-                                                                               
  clip.getDuration() +
-                                                                               
'<span onClick="'+this.instance_name+'.adjClipDur(' + track_id + ',' + j + 
',\'+\')" /> + </span>'+ 
+                                               track_html+='<div id="' + 
base_id + '_adj' + '" class="mv_adj_text" style="top:'+ 
(this.track_clipThumb_height+10 )+'px;">'+
+                                                                               
'<span class="mv_adjust_click" onClick="'+this.instance_name+'.adjClipDur(' + 
track_id + ',' + j + ',\'-\')" /> - </span>'+
+                                                                               
  ( (clip.getDuration() > 60 )? seconds2ntp(clip.getDuration()): 
clip.getDuration() )  +
+                                                                               
'<span class="mv_adjust_click" onClick="'+this.instance_name+'.adjClipDur(' + 
track_id + ',' + j + ',\'+\')" /> + </span>'+ 
                                                                        
'</div>';                                                                       
                                                                
                                                track_html+='</span>';          
                                
                                                                                
                        
@@ -702,7 +728,7 @@
                                                //add in per clip controls
                                                track_html+='<div 
title="'+getMsg('clip_in')+' '+clip.embed.start_ntp+'" class="ui-resizable-w 
ui-resizable-handle" style="width: 16px; height: 16px; left: 0px; top: 
2px;background:url(\''+mv_embed_path+'images/application_side_contract.png\');" 
></div>'+"\n";
                                                track_html+='<div 
title="'+getMsg('clip_out')+' '+clip.embed.end_ntp+'" class="ui-resizable-e 
ui-resizable-handle" style="width: 16px; height: 16px; right: 0px; top: 
2px;background:url(\''+mv_embed_path+'images/application_side_expand.png\');" 
></div>'+"\n";
-                                               track_html+='<div 
title="'+getMsg('rmclip')+'" 
onClick="'+this.instance_name+'.removeClip('+track_id+','+j+')" 
style="position:absolute;cursor:pointer;width: 16px; height: 16px; left: 0px; 
bottom:2px;background:url(\''+mv_embed_path+'images/delete.png\');"></div>'+"\n";
+                                               track_html+='<div 
title="'+getMsg('rmclip')+'" onClick="'+this.instance_name + '.removeClips([' + 
track_id + ',' + j + '])" style="position:absolute;cursor:pointer;width: 16px; 
height: 16px; left: 0px; 
bottom:2px;background:url(\''+mv_embed_path+'images/delete.png\');"></div>'+"\n";
                                                track_html+='<span 
style="display:none;" class="mv_clip_stats"></span>';        
                                                                                
                                                                                
                                                                        
                                                track_html+='</span>';  
@@ -725,11 +751,22 @@
                                
                                //apply onClick edit controls: 
                                $j('.mv_clip_thumb').click(function(){
-                                       if( 
$j(this).hasClass("mv_selected_clip") ){
-                                               
$j(this).removeClass("mv_selected_clip")
+                                       //if not in mult select mode remove all 
existing selections                             
+                                       if( ! this_seq.multi_clip_select ){
+                                               
$j('.mv_clip_thumb').each(function(){
+                                                       
$j(this).removeClass("mv_selected_clip");
+                                                       $j('#' + 
$j(this).parent().attr("id") + '_adj').fadeOut("fast");
+                                               });
+                                       }
+                                       //jump to clip time
+                                       var track_clip_ids = 
$j(this).parent().attr('id').replace('track_','').replace('clip_','').split('_');
          
+                                       js_log(' updateCurrentClip: ' +         
track_clip_ids[0] +' ' +  track_clip_ids[1] );
+                                       this_seq.plObj.updateCurrentClip( 
this_seq.plObj.tracks[ track_clip_ids[0] ].clips[ track_clip_ids[1] ] );
+                                       if( 
$j(this).hasClass("mv_selected_clip") ){                                        
                    
+                                               
$j(this).removeClass("mv_selected_clip");
                                                $j('#' + 
$j(this).parent().attr("id") + '_adj').fadeOut("fast");
-                                       }else{
-                                               
$j(this).addClass('mv_selected_clip');
+                                       }else{                                  
                                                                                
+                                               
$j(this).addClass('mv_selected_clip');                                          
                                                $j('#' + 
$j(this).parent().attr("id") + '_adj').fadeIn("fast");
                                        }                                       
                                });
@@ -996,8 +1033,7 @@
                this.playline_time = jh_time;
                js_log('time: ' + seconds2ntp(jh_time) + ' ' + 
Math.round(jh_time/this.timeline_scale));
                //render playline at given time
-               $j('#'+this.timeline_id+'_playline').css('left', 
Math.round(jh_time/this.timeline_scale)+'px' );
-               //@@ in the future this will render the state at that time 
point (combining tracks etc) 
+               $j('#'+this.timeline_id+'_playline').css('left', 
Math.round(jh_time/this.timeline_scale)+'px' );                 
                cur_pl_time=0;
                //update the thumb with the requested time:             
                this.plObj.updateThumbTime( jh_time );          

Modified: 
trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/mv_sequence.css
===================================================================
--- trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/mv_sequence.css     
2008-11-14 19:11:52 UTC (rev 43499)
+++ trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/mv_sequence.css     
2008-11-14 19:44:42 UTC (rev 43500)
@@ -95,16 +95,17 @@
 .mv_clip_list_result{
        padding:10px;
 }
-.mv_time_clip{
+.mv_storyboard_container{
        position:absolute;
        z-index:0;
        overflow:hidden;
-       border:solid thin white;        
 }
 .mv_clip_thumb{
        position:absolute;
        top:7px;        
-       border:solid thin #BBB; 
+       border:solid #CCC;
+       display:block;
+       overflow:hidden;        
 }
 .mv_tl_clip{
        position:absolute;
@@ -117,5 +118,16 @@
        white-space: nowrap; 
 }
 .mv_selected_clip{
-       border:solid thin #9F9;         
+       border:solid #9F9;      
 }
+.mv_adj_text{
+       font-weight: strong;
+       font-size:small;
+       color:#6F6;
+       display:none; /* hide by default */
+       position:absolute;
+       left:20px;
+}
+.mv_adjust_click{
+       cursor:pointer;
+}
\ No newline at end of file

Modified: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/styles.css
===================================================================
--- trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/styles.css  
2008-11-14 19:11:52 UTC (rev 43499)
+++ trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/styles.css  
2008-11-14 19:44:42 UTC (rev 43500)
@@ -278,7 +278,7 @@
        width: 14px;
        height: 14px;
        position: relative;
-       z-index: 5;
+       z-index: 6;
        margin: -13px 0 0 0px;
        cursor: pointer;
 }
@@ -463,6 +463,12 @@
        float: right;
        display: inline;
 }
+.cl_status{
+       position:absolute; 
+       height:12px;
+       top:0px;
+       z-index:5;
+}
 
 #SEQUENCER CSS:
 #resizable css:



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to