r43500 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43499‎ | r43500 | r43501 >
Date:19:44, 14 November 2008
Author:dale
Status:deferred
Tags:
Comment:
* 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 (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/mv_oneTime_fixes.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.inc.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/simple_cron.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/transcode_to_flv.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/tv2mvWiki/README (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_flashEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_htmlEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_vlcEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_playlists.php (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_sequencer.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/mv_sequence.css (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/styles.css (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.inc.php
@@ -819,8 +819,14 @@
820820
821821 class MV_ArchiveOrgScrape extends MV_BaseScraper {
822822 function getFileList( $stream_name ) {
823 - $raw_page = $this->doRequest( 'http://www.archive.org/details/mv_' . $stream_name );
824 - preg_match_all( '/href="(http:\/\/www.archive.org\/download\/mv_[^"]*)">([^<]*)<\/a>([^<]*)/', $raw_page, $matches );
 823+ //get the latest archive.org page:
 824+ $raw_page = $this->doRequest( 'http://www.archive.org/details/mv_' . $stream_name, array(), $get_fresh=true );
 825+ if($raw_page=='')
 826+ return false;
 827+ //print "Raw page: $raw_page";
 828+
 829+ preg_match_all( '/href="(\/download\/mv_[^"]*)">([^<]*)<\/a>([^<]*)/', $raw_page, $matches );
 830+
825831 $files = array();
826832 if ( isset( $matches[1] ) ) {
827833 foreach ( $matches as $inx => $set ) {
@@ -828,10 +834,16 @@
829835 $files[$k][$inx] = trim( $v );
830836 }
831837 }
832 - // add the flv:
833 - $files[] = array( '',
834 - 'http://www.archive.org/download/mv_' . $stream_name . '/' . $stream_name . '.flv',
835 - 'flash flv', '' );
 838+ //remove duplicates
 839+ $orgFiles = $files;
 840+ $files = array();
 841+ $dupCheck=array();
 842+ foreach( $orgFiles as $file ){
 843+ if( !isset($dupCheck[ $file[1] ] )){
 844+ $files[] = $file;
 845+ $dupCheck[ $file[1] ] = true;
 846+ }
 847+ }
836848 } else {
837849 return false;
838850 }
@@ -840,12 +852,13 @@
841853 }
842854
843855 class MV_BaseScraper {
 856+ var $number_of_tries = 1;
844857 /*
845858 * simple url cach using the mv_url_cache table
846859 *
847860 * @@todo handle post vars
848861 */
849 - function doRequest( $url, $post_vars = array() ) {
 862+ function doRequest( $url, $post_vars = array(), $get_fresh=false, $try_count=1 ) {
850863 $dbr = wfGetDB( DB_SLAVE );
851864 $dbw = wfGetDB( DB_MASTER );
852865 // check the cache
@@ -853,14 +866,19 @@
854867 // select( $table, $vars, $conds='', $fname = 'Database::select', $options = array() )
855868 $res = $dbr->select( 'mv_url_cache', '*', array( 'url' => $url ), 'MV_BaseScraper::doRequest' );
856869 // @@todo check date for experation
857 - if ( $res->numRows() == 0 ) {
858 - echo "do web request: " . $url . "\n";
 870+ if ( $res->numRows() == 0 || $get_fresh) {
 871+ echo "do web request: " . $url . "\n";
859872 // get the content:
860873 $page = file_get_contents( $url );
861874 if ( $page === false ) {
862 - echo( "error retriving $url retrying...\n" );
863 - sleep( 5 );
864 - return $this->doRequest( $url );
 875+ echo( "error getting url retrying (".$try_count." of $this->number_of_tries)" );
 876+ sleep( 2 );
 877+ if($try_count >= $this->number_of_tries){
 878+ print "could not get url after $this->number_of_tries \n\n";
 879+ return '';
 880+ }
 881+ $try_count++;
 882+ return $this->doRequest( $url, $post_vars, $get_fresh, $try_count );
865883 }
866884 if ( $page != '' ) {
867885 // insert back into the db:
Index: trunk/extensions/MetavidWiki/maintenance/transcode_to_flv.php
@@ -8,16 +8,17 @@
99 if running locally just link it ie on mvbox2:
1010 ln -s /metavid/video_archive /media/mv_ssh_flvMediaStorage
1111 */
12 -$mvMountedSource = '/media/mv_ssh_oggMediaStorage/';
13 -//mvbox2.cse.ucsc.edu
14 -$mvMountedDest = '/media/mv_ssh_flvMediaStorage/';
1512
1613 //include commandLine.inc from the mediaWiki maintance dir:
1714 require_once ('../../../maintenance/commandLine.inc');
18 -
1915 //for generate flv metadata:
2016 include_once('../skins/mv_embed/flvServer/MvFlv.php');
2117
 18+
 19+$mvMountedSource = '/media/mv_ssh_oggMediaStorage/';
 20+//mvbox2.cse.ucsc.edu
 21+$mvMountedDest = '/media/mv_ssh_flvMediaStorage/';
 22+
2223 define('MV_BASE_MEDIA_SERVER_PATH', 'http://mvbox2.cse.ucsc.edu/mvFlvServer.php/');
2324 //ffmpeg based (bad)
2425 //$flvEncodeCommand = 'ffmpeg -i $input -ar 22050 -async 2 -aspect 4:3 -f flv -acodec libmp3lame -ac 1 -ab 32k -b 250k -s 400x300 $output';
Index: trunk/extensions/MetavidWiki/maintenance/mv_oneTime_fixes.php
@@ -16,6 +16,7 @@
1717 actions:
1818 strip_speech_by //strips extra speech by text
1919 update_stream_desc //updates stream desc
 20+ update_archive_org_files //updates pointers to archive.org mp4 streaming
2021
2122 EOT;
2223 exit ();
@@ -32,7 +33,42 @@
3334 case 'update_stream_desc':
3435 update_stream_desc();
3536 break;
 37+ case 'update_archive_org_files':
 38+ run_archive_org_update();
 39+ break;
3640 }
 41+function run_archive_org_update(){
 42+ //first get all the streams:
 43+ include_once( 'metavid2mvWiki.inc.php' );
 44+ $dbr = wfGetDB( DB_READ );
 45+ $dbw = wfGetDB( DB_WRITE );
 46+
 47+ $sql = "SELECT * FROM `mv_streams` LIMIT 0, 5000";
 48+ $result = $dbr->query( $sql );
 49+ while ( $stream = $dbr->fetchObject( $result ) ) {
 50+ //get the wiki page:
 51+ $streamTitle = Title::newFromText($stream->name, MV_NS_STREAM);
 52+ $mArticle = new Article( $streamTitle );
 53+ $mvTitle = new MV_Title($stream->name);
 54+ $stream->archive_org = true;
 55+ $out = mv_semantic_stream_desc($mvTitle, $stream);
 56+
 57+ if(trim($out)!=''){
 58+ //get all the existing cats:
 59+ $wtext = $mArticle->getContent();
 60+ preg_match_all('/Category\:([^\]]*)/',$wtext, $matches);
 61+ if( isset($matches[1]) ){
 62+ foreach($matches[1] as $category){
 63+ $out.="\n[[Category:{$category}]]";
 64+ }
 65+ }
 66+ //now that we keept categories force update the page:
 67+ do_update_wiki_page( $streamTitle, $out, MV_NS_STREAM, $force = true );
 68+
 69+ }
 70+ }
 71+}
 72+
3773 function update_stream_desc(){
3874 /*==Official Record==
3975 *[[GovTrack]] Congressional Record[http://www.govtrack.us/congress/recordindex.xpd?date=20080609&where=h]
@@ -70,9 +106,7 @@
71107 $cur_text=preg_replace('/\*\[\[CSPAN\]\]\'s Congressional Chronicle \[([^\[]*)\]/','*[$1 CSPAN Congressional Chronicle]', $cur_text);
72108 //do force update
73109 do_update_wiki_page( $streamTitle, $cur_text, MV_NS_STREAM, $force = true );
74 - }
75 -
76 -
 110+ }
77111 //update links
78112 }
79113
Index: trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php
@@ -458,18 +458,16 @@
459459
460460 // given a stream name it pulls all metavid stream data and builds semantic wiki page
461461 function mv_semantic_stream_desc( & $mvTitle, & $stream ) {
462 - global $start_time, $end_time;
 462+ global $start_time, $end_time;
463463 /*$sql = "SELECT * FROM `metavid`.`streams` WHERE `name` LIKE '" . $mvTitle->getStreamName() . "'";
464464 $dbr = wfGetDB(DB_SLAVE);
465465 $res = $dbr->query($sql);
466466 //echo "\n" . $sql . "\n";
467467 $stream = $dbr->fetchObject($res);*/
468468 $stream_id = $stream->id;
469 - $out = '';
470 - $pout = mv_proccess_attr( 'stream_attr_varchar', $stream_id );
471 - $pout .= mv_proccess_attr( 'stream_attr_int', $stream_id );
472 - // add links/generic text at the start
473 - $out .= '==Official Record==' . "\n";
 469+ $out = '';
 470+
 471+ // add links/generic text at the start
474472 $date = date( 'Ymd', $start_time );
475473 $cspan_date = date( 'Y-m-d', $start_time );
476474 $ch_type = '';
@@ -478,6 +476,7 @@
479477 if ( strpos( $mvTitle->getStreamName(), 'senate' ) !== false )
480478 $ch_type = 's';
481479 if ( $ch_type != '' ) {
 480+ $out .= '==Official Record==' . "\n";
482481 $out .= '*[http://www.govtrack.us/congress/recordindex.xpd?date=' . $date .
483482 '&where=' . $ch_type .
484483 ' GovTrack Congressional Record]' . "\n\n";
@@ -486,40 +485,65 @@
487486 $out .= '*[http://thomas.loc.gov/cgi-bin/query/B?r110:@FIELD(FLD003+' . $ch_type . ')+@FIELD(DDATE+' . $date . ')' .
488487 ' THOMAS Extension of Remarks]' . "\n\n";
489488 }
 489+ $dbw = wfGetDB( DB_WRITE );
 490+
 491+ //clear out existing archive.org files for the current stream
 492+ $sql = "DELETE FROM `mv_stream_files` WHERE `stream_id`='{$stream->id}' AND `file_desc_msg` LIKE 'ao_file_%' LIMIT 10";
 493+ $dbw->query( $sql );
 494+ print "removed existing archive.org files for $stream->name \n";
 495+
490496 if ( $stream->archive_org != '' ) {
491497 // grab file list from archive.org:
492498 require_once( 'scrape_and_insert.inc.php' );
493499 $aos = new MV_ArchiveOrgScrape();
 500+
494501 $file_list = $aos->getFileList( $stream->name );
 502+ if($file_list===false || count($file_list)==0) {
 503+ print 'no files on archive.org for'. $stream->name ."\n\n";
 504+ return '';
 505+ }
495506 $out .= '==More Media Sources==' . "\n";
496507 // all streams have congretional cronical:
497508 $out .= '*[http://www.c-spanarchives.org/congress/?q=node/69850&date=' . $cspan_date . '&hors=' . $ch_type .
498509 ' CSPAN\'s Congressional Chronicle]' . "\n";
499510
500 - if ( $file_list ) {
 511+ if ( $file_list ) {
501512 $out .= '*[http://www.archive.org/details/mv_' . $stream->name .
502 - ' Archive.org hosted original copy]' . "\n";
 513+ ' Archive.org hosted version]' . "\n";
503514 // also output 'direct' semantic links to alternate file qualities:
504 - $out .= "\n===Full File Links===\n";
505 - $dbw = wfGetDB( DB_WRITE );
 515+ $out .= "\n===Full File Links===\n";
 516+ $found_ogg=false;
506517 foreach ( $file_list as $file ) {
507518 $name = str_replace( ' ', '_', $file[2] );
508 - $url = $file[1];
509 - $size = $file[3];
510 - $out .= "*[[ao_file_{$name}:={$url}|$name]] {$size}\n";
511 -
 519+ $url = 'http://archive.org'.$file[1];
 520+ $size = $file[3];
 521+
512522 // add these files into the mv_files table:
513 - // @@todo future we should tie the mv_files table to the semantic properties?
 523+ // @@todo in the future we should tie the mv_files table to the semantic properties.
514524 // check if already present:
 525+
515526 $quality_msg = 'ao_file_' . $name;
 527+
 528+ if($name=='Ogg_Video'){
 529+ $found_ogg=true;
 530+ }
516531 $path_type = 'url_file';
 532+ if($found_ogg && $name=='512Kb_MPEG4'){
 533+ $quality_msg = 'mv_archive_org_mp4';
 534+ $path_type = 'mp4_stream';
 535+ }
 536+ //print "found ogg $found_ogg name: $name qm:$quality_msg\n";
 537+
 538+ //output stream to wiki text:
 539+ $out .= "*[{$url} $name] {$size}\n";
 540+
517541 $dbr = wfGetDB( DB_SLAVE );
518542 $res = $dbr->query( "SELECT * FROM `mv_stream_files`
519543 WHERE `stream_id`={$mvTitle->getStreamId()}
520544 AND `file_desc_msg`='{$quality_msg}'" );
521545 if ( $dbr->numRows( $res ) == 0 ) {
522 - $sql = "INSERT INTO `mv_stream_files` (`stream_id`, `file_desc_msg`, `path_type`, `path`)" .
523 - " VALUES ('{$mvTitle->getStreamId()}', '{$quality_msg}', '{$path_type}','{$url}' )";
 546+ $sql = "INSERT INTO `mv_stream_files` (`stream_id`,`duration`, `file_desc_msg`, `path_type`, `path`)" .
 547+ " VALUES ('{$mvTitle->getStreamId()}','{$mvTitle->getDuration()}', '{$quality_msg}', '{$path_type}','{$url}' )";
524548 } else {
525549 $row = $dbr->fetchObject( $res );
526550 // update that msg key *just in case*
@@ -530,27 +554,33 @@
531555 $dbw->commit();
532556 // more semantic properties
533557 $out .= "\n\n";
534 - $out .= $pout;
535 - $out .= '[[stream_duration:=' . ( $end_time - $start_time ) . '| ]]' . "\n";
 558+ $out .= '[[stream_duration::' . ( $end_time - $start_time ) . '| ]]' . "\n";
536559 if ( $stream->org_start_time ) {
537 - $out .= '[[original_date:=' . $stream->org_start_time . '| ]]';
 560+ $out .= '[[original_date::' . $stream->org_start_time . '| ]]';
538561 }
539562 }
540563 }
541564 // add stream category (based on sync status)
542 - switch( $stream->sync_status ) {
543 - case 'not_checked':
544 - $out .= "\n\n" . '[[Category:Stream Unchecked]]';
545 - break;
546 - case 'impossible':
547 - $out .= "\n\n" . '[[Category:Stream Out of Sync]]';
548 - break;
549 - case 'in_sync':
550 - $out .= "\n\n" . '[[Category:Stream Basic Sync]]';
551 - // other options [stream high quality sync ];
552 - break;
 565+ //(only add if the wiki page does not exist)
 566+ $wStreamTitle = Title::newFromText($stream->name, MV_NS_STREAM);
 567+ if( !$wStreamTitle->exists() ) {
 568+ switch( $stream->sync_status ) {
 569+ case 'not_checked':
 570+ $out .= "\n\n" . '[[Category:Stream Unchecked]]';
 571+ break;
 572+ case 'impossible':
 573+ $out .= "\n\n" . '[[Category:Stream Out of Sync]]';
 574+ break;
 575+ case 'in_sync':
 576+ $out .= "\n\n" . '[[Category:Stream Basic Sync]]';
 577+ // other options [stream high quality sync ];
 578+ break;
 579+ }
553580 }
554 -
 581+ // add in semantic stream properties
 582+ //$out = mv_proccess_attr( 'stream_attr_varchar', $stream_id );
 583+ //$out .= mv_proccess_attr( 'stream_attr_int', $stream_id );
 584+
555585 return $out;
556586 }
557587 function do_bill_insert( $bill_key ) {
Index: trunk/extensions/MetavidWiki/maintenance/simple_cron.php
@@ -1,4 +1,9 @@
22 <?php
 3+//should only be run from the command line:
 4+if ( php_sapi_name() != 'cli' ) {
 5+ print "This script must be run from the command line\n";
 6+ exit( 1 );
 7+}
38 $i=0;
49 while(true){
510 echo "run update search index:\n";
Index: trunk/extensions/MetavidWiki/maintenance/tv2mvWiki/README
@@ -1,15 +1,11 @@
22 This will eventually host the tools for capturing brodcasted content
3 -and insertting it into a wiki
 3+and inserting it into a wiki/ uploading it to archive.org
44
5 -presently the script metavid project uses are accesible here:
 5+presently the script metavid project uses are accessible here:
66 http://slugforge.cse.ucsc.edu/gf/project/metavid/
7 -but I don't recomend using them not genneraly applicable.
 7+but I don't recommend using them not generally applicable.
88
99
10 -
11 -The genneral flow and machine layout should be as follows:
12 -note: obvisuly your layout may differ and adjustments may be needed.
13 -
1410 dependencies:
1511 metavidWiki
1612 ffmpeg2theora
Index: trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.php
@@ -10,7 +10,7 @@
1111 * @url http://metavid.ucsc.edu
1212 */
1313
14 - $cur_path = $IP = dirname( __FILE__ );
 14+$cur_path = $IP = dirname( __FILE__ );
1515 // include commandLine.inc from the mediaWiki maintenance dir:
1616 require_once( '../../../maintenance/commandLine.inc' );
1717 require_once( 'maintenance_util.inc.php' );
Index: trunk/extensions/MetavidWiki/maintenance/maintenance_util.inc.php
@@ -12,7 +12,7 @@
1313 *
1414 * Maintenance Utility Functions:
1515 */
16 -
 16+require_once ( '../../../maintenance/commandLine.inc' );
1717 /*
1818 * set up the bot user:
1919 */
Index: trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_playlists.php
@@ -45,7 +45,7 @@
4646 '<br>' .
4747 '<iframe width="500" height="200" src="' . $smilURL . '">rss feed here</iframe>';
4848
49 -$smilURL = 'http://localhost/wiki/index.php/Special:MvExportSequence/Test';
 49+$smilURL = 'http://'.$_SERVER['SERVER_NAME'].'/wiki/index.php/Special:MvExportSequence/Test';
5050 $sample_embed[9]['tag'] = '<playlist src="' . $smilURL . '" />';
5151 $sample_embed[9]['desc'] = ' <br><b>MediaWiki example:</b><br/>'.
5252 '<br>' .
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_flashEmbed.js
@@ -1636,13 +1636,7 @@
16371637 this.getFLA();
16381638 this.parent_pause();
16391639 if(this.fla['pause'])
1640 - this.fla.pause();
1641 - //stop updates:
1642 - if( this.monitorTimerId != 0 )
1643 - {
1644 - clearInterval(this.monitorTimerId);
1645 - this.monitorTimerId = 0;
1646 - }
 1640+ this.fla.pause();
16471641 },
16481642 monitor : function()
16491643 {
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_htmlEmbed.js
@@ -77,8 +77,8 @@
7878 return true;
7979 },
8080 renderTimelineThumbnail:function( options ){
81 - //generate a scaled down version _that_ we can clone if nessisary
82 - //add a not visiable container to the body:
 81+ //generate a scaled down version _that_ we can clone if nessisary
 82+ //add a not vissiable container to the body:
8383 var do_refresh = (typeof options['refresh'] != 'undefined')?true:false;
8484
8585 var thumb_render_id = this.id +'_thumb_render_'+ options.height;
@@ -91,8 +91,8 @@
9292 var thumb_class = (typeof options['thumb_class'] !='undefined')? options['thumb_class'] : '';
9393
9494 $j('body').append( '<div id="' + thumb_render_id + '" style="display:none">'+
95 - '<div class="' + thumb_class + '" style="display:block;border:solid thin black;'+
96 - 'width:'+options.width+'px;height:'+options.height+'px;overflow:hidden;" >'+
 95+ '<div class="' + thumb_class + '" '+
 96+ 'style="width:'+options.width+'px;height:'+options.height+'px;" >'+
9797 this.getThumbnailHTML() +
9898 '</div>'+
9999 '</div>'
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_vlcEmbed.js
@@ -211,7 +211,12 @@
212212 this.duration = this.vlc.input.length /1000;
213213 }*/
214214 //update the currentTime attribute
215 - this.currentTime =this.vlc.input.time/1000;
 215+ if( this.media_element.selected_source.timeFormat =='anx' ){
 216+ this.currentTime = this.vlc.input.time/1000;
 217+ //js_log('set buffer: ' + flash_state.bufferEnd + ' at time: ' + flash_state.time +' of total dur: ' + this.getDuration());
 218+ }else{
 219+ this.currentTime = (this.vlc.input.time/1000) + this.media_element.selected_source.start_offset;
 220+ }
216221 if( this.duration > 0 || this.vlc.input.time > 0){
217222 this.start_offset=this.media_element.selected_source.start_offset;
218223
Index: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/mv_sequence.css
@@ -95,16 +95,17 @@
9696 .mv_clip_list_result{
9797 padding:10px;
9898 }
99 -.mv_time_clip{
 99+.mv_storyboard_container{
100100 position:absolute;
101101 z-index:0;
102102 overflow:hidden;
103 - border:solid thin white;
104103 }
105104 .mv_clip_thumb{
106105 position:absolute;
107106 top:7px;
108 - border:solid thin #BBB;
 107+ border:solid #CCC;
 108+ display:block;
 109+ overflow:hidden;
109110 }
110111 .mv_tl_clip{
111112 position:absolute;
@@ -117,5 +118,16 @@
118119 white-space: nowrap;
119120 }
120121 .mv_selected_clip{
121 - border:solid thin #9F9;
 122+ border:solid #9F9;
122123 }
 124+.mv_adj_text{
 125+ font-weight: strong;
 126+ font-size:small;
 127+ color:#6F6;
 128+ display:none; /* hide by default */
 129+ position:absolute;
 130+ left:20px;
 131+}
 132+.mv_adjust_click{
 133+ cursor:pointer;
 134+}
\ No newline at end of file
Index: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/styles.css
@@ -278,7 +278,7 @@
279279 width: 14px;
280280 height: 14px;
281281 position: relative;
282 - z-index: 5;
 282+ z-index: 6;
283283 margin: -13px 0 0 0px;
284284 cursor: pointer;
285285 }
@@ -463,6 +463,12 @@
464464 float: right;
465465 display: inline;
466466 }
 467+.cl_status{
 468+ position:absolute;
 469+ height:12px;
 470+ top:0px;
 471+ z-index:5;
 472+}
467473
468474 #SEQUENCER CSS:
469475 #resizable css:
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -2234,7 +2234,7 @@
22352235 var etime_parts = times[1].split(':');
22362236
22372237 var new_anno_track_url = annoURL.protocol +'://'+ annoURL.host + annoURL.path +'?';
2238 - for(i in annoURL.queryKey){
 2238+ for(var i in annoURL.queryKey){
22392239 new_anno_track_url +=(i=='t')?'t='+new_start+'/'+new_end +'&' :
22402240 i+'='+ annoURL.queryKey[i]+'&';
22412241 }
@@ -2461,9 +2461,13 @@
24622462 my_thumb_src = getUpdateTimeURL( my_thumb_src, time_ntp, options.size );
24632463 }
24642464 var thumb_class = (typeof options['thumb_class'] !='undefined')? options['thumb_class'] : '';
2465 - return '<img class="' + thumb_class + '" src="' + my_thumb_src +'" '+
 2465+ return '<div class="' + thumb_class + '" src="' + my_thumb_src +'" '+
24662466 'style="height:' + options.height + 'px;' +
2467 - 'width:' + options.width + 'px" >';
 2467+ 'width:' + options.width + 'px" >' +
 2468+ '<img src="' + my_thumb_src +'" '+
 2469+ 'style="height:' + options.height + 'px;' +
 2470+ 'width:' + options.width + 'px">' +
 2471+ '</div>';
24682472 },
24692473 updateThumbTime:function( float_sec ){
24702474 var _this = this;
@@ -2820,7 +2824,7 @@
28212825 * there is no general way to pause the video
28222826 * must be overwritten by embed object to support this functionality.
28232827 */
2824 - pause : function(){
 2828+ pause: function(){
28252829 js_log('mv_embed:do pause');
28262830 var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
28272831 //(playing) do pause
@@ -2828,7 +2832,7 @@
28292833 //update "paused state"
28302834 $j("#mv_play_pause_button_"+this_id).attr('class', 'play_button');
28312835 },
2832 - play_or_pause : function(){
 2836+ play_or_pause: function(){
28332837 js_log('embed:f:play_or_pause');
28342838 //check state and set play or pause
28352839 if(this.paused){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_sequencer.js
@@ -69,7 +69,6 @@
7070
7171 base_adj_duration:.5, //default time to subtract or add when adjusting clips.
7272
73 -
7473 //Msg are all the language specific values ...
7574 // (@@todo overwrite by msg values preloaded in the page)
7675 //tack/clips can be pushed via json or inline playlist format
@@ -95,6 +94,7 @@
9695 'options':0
9796 //menu_resource_overview
9897 },
 98+ multi_clip_select:false, //controls the multi-clip select state
9999 init:function( initObj ){
100100 //set the default values:
101101 for(var i in sequencerDefaultValues){
@@ -189,7 +189,7 @@
190190 req_url+='|'+i;
191191 $j('#'+i+'_ic').html( getMsg('loading_txt') );//set targets to loading
192192 }
193 - var _this = this;
 193+ var this_seq = this;
194194 do_request(req_url, function(data){
195195 if(typeof data=='string'){
196196 js_log(' eval data: ' + data);
@@ -199,12 +199,12 @@
200200 for(var i in data){
201201 js_log('set '+ i + ' to: '+ data[i] );
202202 $j('#'+i+'_ic').html( data[i] );
203 - _this.doMenuItemDispJs(i)
 203+ this_seq.doMenuItemDispJs(i)
204204 }
205205 });
206206 },
207207 doMenuItemDispJs:function(item){
208 - var _this = this;
 208+ var this_seq = this;
209209 var target_id = item + '_ic';
210210 //do any menu item post embed js hook processing:
211211 switch(item){
@@ -220,9 +220,9 @@
221221 return js_log( 'Error:missing interface_url, can not load search interface' );
222222
223223 mvJsLoader.doLoad({'mvRemoteSearch':'mv_remote_media_search.js'}, function(){
224 - _this.mySearch = new mvRemoteSearch( {
225 - 'p_seq':_this,
226 - 'instance_name': _this.instance_name + '.mySearch',
 224+ this_seq.mySearch = new mvRemoteSearch( {
 225+ 'p_seq':this_seq,
 226+ 'instance_name': this_seq.instance_name + '.mySearch',
227227 'target_input':'mv_ams_search',
228228 'target_submit':'mv_ams_submit',
229229 'target_results':'mv_ams_results'
@@ -231,15 +231,15 @@
232232 break;
233233 case 'options':
234234 $j('#'+target_id+" input[value='simple_editor']").attr({
235 - 'checked':(_this.timeline_mode=='clip')?true:false
 235+ 'checked':(this_seq.timeline_mode=='clip')?true:false
236236 }).click(function(){
237 - _this.doSimpleTl();
 237+ this_seq.doSimpleTl();
238238 });
239239 $j('#'+target_id+" input[value='advanced_editor']").attr({
240 - 'checked':(_this.timeline_mode=='time')?true:false
241 - }).click(function(){
242 - _this.doAdvancedTl();
243 - });
 240+ 'checked':( this_seq.timeline_mode=='time' )?true:false
 241+ }).click(function(){
 242+ this_seq.doAdvancedTl();
 243+ });
244244 break;
245245 }
246246 },
@@ -325,8 +325,7 @@
326326 );
327327 //also render the clips in the trackset container: (thumb or text view)
328328 $j('#'+this.timeline_id+'_tracks').append(
329 - '<div id="container_track_'+i+'" style="top:'+top_pos+'px;height:'+(track_height+2)+'px;left:0px;right:0px;" class="container_track">' +
330 - '</div>'
 329+ '<div id="container_track_'+i+'" style="top:'+top_pos+'px;height:'+(track_height+2)+'px;left:0px;right:0px;" class="container_track" />'
331330 );
332331 top_pos+=track_height+20;
333332 }
@@ -338,7 +337,7 @@
339338 var track_height=this.track_clipThumb_height;
340339 //add in play box and container tracks
341340 $j('#'+this.timeline_id).append(''+
342 - '<div id="container_track_'+i+'" style="position:absolute;top:20px;height:'+(track_height+20)+'px;left:10px;right:0px;" class="container_track">' +
 341+ '<div id="container_track_'+i+'" style="position:absolute;top:25px;height:'+(track_height+30)+'px;left:10px;right:0px;" class="container_track">' +
343342 '</div>'
344343 );
345344 top_pos+=track_height+20;
@@ -391,6 +390,35 @@
392391 //render the timeline
393392 this.renderTimeLine();
394393 this.do_refresh_timeline();
 394+
 395+ var this_seq = this;
 396+ //set up key bidnings
 397+ $j().keyup(function (e) {
 398+ js_log('pressed: ' + e.which);
 399+ //delete key (remove selected clips) (in the future we should take app state into consideration)
 400+ if( e.which == 8 ){
 401+ var remove_clip_ary=new Array();
 402+ //remove selected clips from display
 403+ $j('.container_track .mv_selected_clip').each(function(){
 404+ //grab the track index from the id (assumes track_#_clip_#
 405+ remove_clip_ary.push ( $j(this).parent().attr('id').replace('track_','').replace('clip_','').split('_') );
 406+ });
 407+ this_seq.removeClips( remove_clip_ary );
 408+ }
 409+ });
 410+ $j().keydown(function(e){
 411+ js_log('pushed down on:' + e.which);
 412+ //if user pressed "shift" enable multi-select
 413+ if( e.which == 16 ){
 414+ this_seq.multi_clip_select = true;
 415+ }
 416+ });
 417+ $j().keyup(function(e){
 418+ js_log('key up on ' + e.which);
 419+ if( e.which == 16 ){
 420+ this_seq.multi_clip_select = false;
 421+ }
 422+ });
395423 },
396424 update_tl_hook:function(jh_time_ms){
397425 //put into seconds scale:
@@ -528,28 +556,27 @@
529557 $j('#modal_window').hide();
530558 $j('#modalbox').show();
531559 },
532 - removeClip:function(track_inx, clip_inx){
533 - //fade out fast:
 560+ removeClips:function( remove_clip_ary ){
 561+ //js_log('remove t:' + track_inx + ' c:'+ clip_inx + ' id:' +' #track_'+track_inx+'_clip_'+clip_inx);
534562 var this_seq = this;
535 - $j('#track_'+track_inx+'_clip_'+clip_inx).fadeOut("fast",function(){
536 - this_seq.plObj.tracks[track_inx].clips.splice(clip_inx, 1);
537 - //reorder:
538 - for( var k in this_seq.plObj.tracks[track_inx].clips){
539 - if(typeof this_seq.plObj.tracks[track_inx].clips[i]!= 'undefined'){
540 - this_seq.plObj.tracks[track_inx].clips[i].order=k;
541 - }
542 - }
 563+ var jselect = coma ='';
 564+ $j.each( remove_clip_ary, function(inx, track_clip){
 565+ //remove the clips from the base library
 566+ this_seq.plObj.tracks[ track_clip[0] ].clips.splice( track_clip[1], 1);
 567+ jselect+= coma + '#track_' + track_clip[0] + '_clip_' + track_clip[1];
 568+ coma=',';
 569+ });
 570+ //animate the removal
 571+ $j(jselect).fadeOut("slow", function(){
543572 //re-render tracks:
544 - this_seq.render_tracks( track_inx );
545 -
546 - if(this_seq.plObj.tracks[track_inx].clips.length==0){
547 - this_seq.plObj.getHTML();
548 - }else{
549 - //update playlist desc:
550 - this_seq.plObj.pl_duration=null;
551 - this_seq.plObj.updateTitle();
552 - }
553 - });
 573+ this_seq.do_refresh_timeline();
 574+ });
 575+ //reorder:
 576+ //for( var k in this_seq.plObj.tracks[track_inx].clips){
 577+ // if(typeof this_seq.plObj.tracks[track_inx].clips[i] != 'undefined'){
 578+ // this_seq.plObj.tracks[track_inx].clips[i].order=k;
 579+ // }
 580+ //}
554581 },
555582 doEdit:function( editObj ){
556583 //add the current editObj to the edit stack (should allow for "undo")
@@ -651,11 +678,10 @@
652679 clip.width_px = container_width;
653680 var base_id = 'track_'+track_id+'_clip_'+j;
654681 track_html+='<span id="'+base_id+'" '+
655 - 'class="mv_time_clip mv_clip_drag" '+
656 - 'style="'+
657 - 'border:none;'+
 682+ 'class="mv_storyboard_container mv_clip_drag" '+
 683+ 'style="'+
658684 'left:'+clip.left_px+'px;'+
659 - 'height:' + (this.track_clipThumb_height+20) + 'px;' +
 685+ 'height:' + (this.track_clipThumb_height+30) + 'px;' +
660686 'width:'+(container_width)+'px;" >';
661687 track_html+=clip.embed.renderTimelineThumbnail({
662688 'width':frame_width,
@@ -670,10 +696,10 @@
671697 track_html+='<div style="" id="tb_' + base_id + '" class="clip_trans_box"/>';
672698
673699 //render out adjustment text
674 - track_html+='<div id="' + base_id + '_adj' + '" style="font-size:small;color:#6F6;display:none;position:absolute;top:'+ (this.track_clipThumb_height+10 )+'px;>'+
675 - '<span onClick="'+this.instance_name+'.adjClipDur(' + track_id + ',' + j + ',\'-\')" /> - </span>'+
676 - clip.getDuration() +
677 - '<span onClick="'+this.instance_name+'.adjClipDur(' + track_id + ',' + j + ',\'+\')" /> + </span>'+
 700+ track_html+='<div id="' + base_id + '_adj' + '" class="mv_adj_text" style="top:'+ (this.track_clipThumb_height+10 )+'px;">'+
 701+ '<span class="mv_adjust_click" onClick="'+this.instance_name+'.adjClipDur(' + track_id + ',' + j + ',\'-\')" /> - </span>'+
 702+ ( (clip.getDuration() > 60 )? seconds2ntp(clip.getDuration()): clip.getDuration() ) +
 703+ '<span class="mv_adjust_click" onClick="'+this.instance_name+'.adjClipDur(' + track_id + ',' + j + ',\'+\')" /> + </span>'+
678704 '</div>';
679705 track_html+='</span>';
680706
@@ -702,7 +728,7 @@
703729 //add in per clip controls
704730 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";
705731 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";
706 - 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";
 732+ 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";
707733 track_html+='<span style="display:none;" class="mv_clip_stats"></span>';
708734
709735 track_html+='</span>';
@@ -725,11 +751,22 @@
726752
727753 //apply onClick edit controls:
728754 $j('.mv_clip_thumb').click(function(){
729 - if( $j(this).hasClass("mv_selected_clip") ){
730 - $j(this).removeClass("mv_selected_clip")
 755+ //if not in mult select mode remove all existing selections
 756+ if( ! this_seq.multi_clip_select ){
 757+ $j('.mv_clip_thumb').each(function(){
 758+ $j(this).removeClass("mv_selected_clip");
 759+ $j('#' + $j(this).parent().attr("id") + '_adj').fadeOut("fast");
 760+ });
 761+ }
 762+ //jump to clip time
 763+ var track_clip_ids = $j(this).parent().attr('id').replace('track_','').replace('clip_','').split('_');
 764+ js_log(' updateCurrentClip: ' + track_clip_ids[0] +' ' + track_clip_ids[1] );
 765+ this_seq.plObj.updateCurrentClip( this_seq.plObj.tracks[ track_clip_ids[0] ].clips[ track_clip_ids[1] ] );
 766+ if( $j(this).hasClass("mv_selected_clip") ){
 767+ $j(this).removeClass("mv_selected_clip");
731768 $j('#' + $j(this).parent().attr("id") + '_adj').fadeOut("fast");
732 - }else{
733 - $j(this).addClass('mv_selected_clip');
 769+ }else{
 770+ $j(this).addClass('mv_selected_clip');
734771 $j('#' + $j(this).parent().attr("id") + '_adj').fadeIn("fast");
735772 }
736773 });
@@ -996,8 +1033,7 @@
9971034 this.playline_time = jh_time;
9981035 js_log('time: ' + seconds2ntp(jh_time) + ' ' + Math.round(jh_time/this.timeline_scale));
9991036 //render playline at given time
1000 - $j('#'+this.timeline_id+'_playline').css('left', Math.round(jh_time/this.timeline_scale)+'px' );
1001 - //@@ in the future this will render the state at that time point (combining tracks etc)
 1037+ $j('#'+this.timeline_id+'_playline').css('left', Math.round(jh_time/this.timeline_scale)+'px' );
10021038 cur_pl_time=0;
10031039 //update the thumb with the requested time:
10041040 this.plObj.updateThumbTime( jh_time );
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js
@@ -547,6 +547,8 @@
548548 $j('#clipDesc_'+this.cur_clip.id).hide();
549549 this.cur_clip=new_clip;
550550 $j('#clipDesc_'+this.cur_clip.id).show();
 551+ //update the playhead:
 552+ this.setSliderValue( this.cur_clip.dur_offset / this.getDuration() );
551553 },
552554 prev: function(){
553555 //advance the playhead to the previous clip
@@ -715,19 +717,13 @@
716718 var pwidth = Math.round( perc * _this.track_len);
717719 //var pwidth = Math.round( perc * _this.track_len - (_this.mv_seeker_width*perc) );
718720
719 - var barHtml = '<div id="cl_status_'+clip.id+'" style="' +
720 - 'position:absolute;' +
 721+ var barHtml = '<div id="cl_status_'+clip.id+'" class="cl_status" style="' +
721722 'left:'+cur_pixle +'px;'+
722 - 'width:'+pwidth + 'px;'+
723 - 'height:12px;'+
724 - 'top:0px;'+
725 - 'z-index:1;';
 723+ 'width:'+pwidth + 'px;';
726724 //set left or right border based on track pos
727725 barHtml+=( i == _this.default_track.getClipCount()-1 )?
728726 'border-left:solid thin black;':
729 - 'border-right:solid thin black;';
730 -
731 -
 727+ 'border-right:solid thin black;';
732728 barHtml+= 'filter:alpha(opacity=40);'+
733729 '-moz-opacity:.40;">'
734730 '</div>';

Status & tagging log