Index: trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.inc.php |
— | — | @@ -819,8 +819,14 @@ |
820 | 820 | |
821 | 821 | class MV_ArchiveOrgScrape extends MV_BaseScraper { |
822 | 822 | 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 | + |
825 | 831 | $files = array(); |
826 | 832 | if ( isset( $matches[1] ) ) { |
827 | 833 | foreach ( $matches as $inx => $set ) { |
— | — | @@ -828,10 +834,16 @@ |
829 | 835 | $files[$k][$inx] = trim( $v ); |
830 | 836 | } |
831 | 837 | } |
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 | + } |
836 | 848 | } else { |
837 | 849 | return false; |
838 | 850 | } |
— | — | @@ -840,12 +852,13 @@ |
841 | 853 | } |
842 | 854 | |
843 | 855 | class MV_BaseScraper { |
| 856 | + var $number_of_tries = 1; |
844 | 857 | /* |
845 | 858 | * simple url cach using the mv_url_cache table |
846 | 859 | * |
847 | 860 | * @@todo handle post vars |
848 | 861 | */ |
849 | | - function doRequest( $url, $post_vars = array() ) { |
| 862 | + function doRequest( $url, $post_vars = array(), $get_fresh=false, $try_count=1 ) { |
850 | 863 | $dbr = wfGetDB( DB_SLAVE ); |
851 | 864 | $dbw = wfGetDB( DB_MASTER ); |
852 | 865 | // check the cache |
— | — | @@ -853,14 +866,19 @@ |
854 | 867 | // select( $table, $vars, $conds='', $fname = 'Database::select', $options = array() ) |
855 | 868 | $res = $dbr->select( 'mv_url_cache', '*', array( 'url' => $url ), 'MV_BaseScraper::doRequest' ); |
856 | 869 | // @@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"; |
859 | 872 | // get the content: |
860 | 873 | $page = file_get_contents( $url ); |
861 | 874 | 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 ); |
865 | 883 | } |
866 | 884 | if ( $page != '' ) { |
867 | 885 | // insert back into the db: |
Index: trunk/extensions/MetavidWiki/maintenance/transcode_to_flv.php |
— | — | @@ -8,16 +8,17 @@ |
9 | 9 | if running locally just link it ie on mvbox2: |
10 | 10 | ln -s /metavid/video_archive /media/mv_ssh_flvMediaStorage |
11 | 11 | */ |
12 | | -$mvMountedSource = '/media/mv_ssh_oggMediaStorage/'; |
13 | | -//mvbox2.cse.ucsc.edu |
14 | | -$mvMountedDest = '/media/mv_ssh_flvMediaStorage/'; |
15 | 12 | |
16 | 13 | //include commandLine.inc from the mediaWiki maintance dir: |
17 | 14 | require_once ('../../../maintenance/commandLine.inc'); |
18 | | - |
19 | 15 | //for generate flv metadata: |
20 | 16 | include_once('../skins/mv_embed/flvServer/MvFlv.php'); |
21 | 17 | |
| 18 | + |
| 19 | +$mvMountedSource = '/media/mv_ssh_oggMediaStorage/'; |
| 20 | +//mvbox2.cse.ucsc.edu |
| 21 | +$mvMountedDest = '/media/mv_ssh_flvMediaStorage/'; |
| 22 | + |
22 | 23 | define('MV_BASE_MEDIA_SERVER_PATH', 'http://mvbox2.cse.ucsc.edu/mvFlvServer.php/'); |
23 | 24 | //ffmpeg based (bad) |
24 | 25 | //$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 @@ |
17 | 17 | actions: |
18 | 18 | strip_speech_by //strips extra speech by text |
19 | 19 | update_stream_desc //updates stream desc |
| 20 | + update_archive_org_files //updates pointers to archive.org mp4 streaming |
20 | 21 | |
21 | 22 | EOT; |
22 | 23 | exit (); |
— | — | @@ -32,7 +33,42 @@ |
33 | 34 | case 'update_stream_desc': |
34 | 35 | update_stream_desc(); |
35 | 36 | break; |
| 37 | + case 'update_archive_org_files': |
| 38 | + run_archive_org_update(); |
| 39 | + break; |
36 | 40 | } |
| 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 | + |
37 | 73 | function update_stream_desc(){ |
38 | 74 | /*==Official Record== |
39 | 75 | *[[GovTrack]] Congressional Record[http://www.govtrack.us/congress/recordindex.xpd?date=20080609&where=h] |
— | — | @@ -70,9 +106,7 @@ |
71 | 107 | $cur_text=preg_replace('/\*\[\[CSPAN\]\]\'s Congressional Chronicle \[([^\[]*)\]/','*[$1 CSPAN Congressional Chronicle]', $cur_text); |
72 | 108 | //do force update |
73 | 109 | do_update_wiki_page( $streamTitle, $cur_text, MV_NS_STREAM, $force = true ); |
74 | | - } |
75 | | - |
76 | | - |
| 110 | + } |
77 | 111 | //update links |
78 | 112 | } |
79 | 113 | |
Index: trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php |
— | — | @@ -458,18 +458,16 @@ |
459 | 459 | |
460 | 460 | // given a stream name it pulls all metavid stream data and builds semantic wiki page |
461 | 461 | function mv_semantic_stream_desc( & $mvTitle, & $stream ) { |
462 | | - global $start_time, $end_time; |
| 462 | + global $start_time, $end_time; |
463 | 463 | /*$sql = "SELECT * FROM `metavid`.`streams` WHERE `name` LIKE '" . $mvTitle->getStreamName() . "'"; |
464 | 464 | $dbr = wfGetDB(DB_SLAVE); |
465 | 465 | $res = $dbr->query($sql); |
466 | 466 | //echo "\n" . $sql . "\n"; |
467 | 467 | $stream = $dbr->fetchObject($res);*/ |
468 | 468 | $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 |
474 | 472 | $date = date( 'Ymd', $start_time ); |
475 | 473 | $cspan_date = date( 'Y-m-d', $start_time ); |
476 | 474 | $ch_type = ''; |
— | — | @@ -478,6 +476,7 @@ |
479 | 477 | if ( strpos( $mvTitle->getStreamName(), 'senate' ) !== false ) |
480 | 478 | $ch_type = 's'; |
481 | 479 | if ( $ch_type != '' ) { |
| 480 | + $out .= '==Official Record==' . "\n"; |
482 | 481 | $out .= '*[http://www.govtrack.us/congress/recordindex.xpd?date=' . $date . |
483 | 482 | '&where=' . $ch_type . |
484 | 483 | ' GovTrack Congressional Record]' . "\n\n"; |
— | — | @@ -486,40 +485,65 @@ |
487 | 486 | $out .= '*[http://thomas.loc.gov/cgi-bin/query/B?r110:@FIELD(FLD003+' . $ch_type . ')+@FIELD(DDATE+' . $date . ')' . |
488 | 487 | ' THOMAS Extension of Remarks]' . "\n\n"; |
489 | 488 | } |
| 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 | + |
490 | 496 | if ( $stream->archive_org != '' ) { |
491 | 497 | // grab file list from archive.org: |
492 | 498 | require_once( 'scrape_and_insert.inc.php' ); |
493 | 499 | $aos = new MV_ArchiveOrgScrape(); |
| 500 | + |
494 | 501 | $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 | + } |
495 | 506 | $out .= '==More Media Sources==' . "\n"; |
496 | 507 | // all streams have congretional cronical: |
497 | 508 | $out .= '*[http://www.c-spanarchives.org/congress/?q=node/69850&date=' . $cspan_date . '&hors=' . $ch_type . |
498 | 509 | ' CSPAN\'s Congressional Chronicle]' . "\n"; |
499 | 510 | |
500 | | - if ( $file_list ) { |
| 511 | + if ( $file_list ) { |
501 | 512 | $out .= '*[http://www.archive.org/details/mv_' . $stream->name . |
502 | | - ' Archive.org hosted original copy]' . "\n"; |
| 513 | + ' Archive.org hosted version]' . "\n"; |
503 | 514 | // 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; |
506 | 517 | foreach ( $file_list as $file ) { |
507 | 518 | $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 | + |
512 | 522 | // 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. |
514 | 524 | // check if already present: |
| 525 | + |
515 | 526 | $quality_msg = 'ao_file_' . $name; |
| 527 | + |
| 528 | + if($name=='Ogg_Video'){ |
| 529 | + $found_ogg=true; |
| 530 | + } |
516 | 531 | $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 | + |
517 | 541 | $dbr = wfGetDB( DB_SLAVE ); |
518 | 542 | $res = $dbr->query( "SELECT * FROM `mv_stream_files` |
519 | 543 | WHERE `stream_id`={$mvTitle->getStreamId()} |
520 | 544 | AND `file_desc_msg`='{$quality_msg}'" ); |
521 | 545 | 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}' )"; |
524 | 548 | } else { |
525 | 549 | $row = $dbr->fetchObject( $res ); |
526 | 550 | // update that msg key *just in case* |
— | — | @@ -530,27 +554,33 @@ |
531 | 555 | $dbw->commit(); |
532 | 556 | // more semantic properties |
533 | 557 | $out .= "\n\n"; |
534 | | - $out .= $pout; |
535 | | - $out .= '[[stream_duration:=' . ( $end_time - $start_time ) . '| ]]' . "\n"; |
| 558 | + $out .= '[[stream_duration::' . ( $end_time - $start_time ) . '| ]]' . "\n"; |
536 | 559 | if ( $stream->org_start_time ) { |
537 | | - $out .= '[[original_date:=' . $stream->org_start_time . '| ]]'; |
| 560 | + $out .= '[[original_date::' . $stream->org_start_time . '| ]]'; |
538 | 561 | } |
539 | 562 | } |
540 | 563 | } |
541 | 564 | // 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 | + } |
553 | 580 | } |
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 | + |
555 | 585 | return $out; |
556 | 586 | } |
557 | 587 | function do_bill_insert( $bill_key ) { |
Index: trunk/extensions/MetavidWiki/maintenance/simple_cron.php |
— | — | @@ -1,4 +1,9 @@ |
2 | 2 | <?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 | +} |
3 | 8 | $i=0; |
4 | 9 | while(true){ |
5 | 10 | echo "run update search index:\n"; |
Index: trunk/extensions/MetavidWiki/maintenance/tv2mvWiki/README |
— | — | @@ -1,15 +1,11 @@ |
2 | 2 | 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 |
4 | 4 | |
5 | | -presently the script metavid project uses are accesible here: |
| 5 | +presently the script metavid project uses are accessible here: |
6 | 6 | 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. |
8 | 8 | |
9 | 9 | |
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 | | - |
14 | 10 | dependencies: |
15 | 11 | metavidWiki |
16 | 12 | ffmpeg2theora |
Index: trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.php |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | * @url http://metavid.ucsc.edu |
12 | 12 | */ |
13 | 13 | |
14 | | - $cur_path = $IP = dirname( __FILE__ ); |
| 14 | +$cur_path = $IP = dirname( __FILE__ ); |
15 | 15 | // include commandLine.inc from the mediaWiki maintenance dir: |
16 | 16 | require_once( '../../../maintenance/commandLine.inc' ); |
17 | 17 | require_once( 'maintenance_util.inc.php' ); |
Index: trunk/extensions/MetavidWiki/maintenance/maintenance_util.inc.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | * |
14 | 14 | * Maintenance Utility Functions: |
15 | 15 | */ |
16 | | - |
| 16 | +require_once ( '../../../maintenance/commandLine.inc' ); |
17 | 17 | /* |
18 | 18 | * set up the bot user: |
19 | 19 | */ |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_playlists.php |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | '<br>' . |
47 | 47 | '<iframe width="500" height="200" src="' . $smilURL . '">rss feed here</iframe>'; |
48 | 48 | |
49 | | -$smilURL = 'http://localhost/wiki/index.php/Special:MvExportSequence/Test'; |
| 49 | +$smilURL = 'http://'.$_SERVER['SERVER_NAME'].'/wiki/index.php/Special:MvExportSequence/Test'; |
50 | 50 | $sample_embed[9]['tag'] = '<playlist src="' . $smilURL . '" />'; |
51 | 51 | $sample_embed[9]['desc'] = ' <br><b>MediaWiki example:</b><br/>'. |
52 | 52 | '<br>' . |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_flashEmbed.js |
— | — | @@ -1636,13 +1636,7 @@ |
1637 | 1637 | this.getFLA(); |
1638 | 1638 | this.parent_pause(); |
1639 | 1639 | 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(); |
1647 | 1641 | }, |
1648 | 1642 | monitor : function() |
1649 | 1643 | { |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_htmlEmbed.js |
— | — | @@ -77,8 +77,8 @@ |
78 | 78 | return true; |
79 | 79 | }, |
80 | 80 | 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: |
83 | 83 | var do_refresh = (typeof options['refresh'] != 'undefined')?true:false; |
84 | 84 | |
85 | 85 | var thumb_render_id = this.id +'_thumb_render_'+ options.height; |
— | — | @@ -91,8 +91,8 @@ |
92 | 92 | var thumb_class = (typeof options['thumb_class'] !='undefined')? options['thumb_class'] : ''; |
93 | 93 | |
94 | 94 | $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;" >'+ |
97 | 97 | this.getThumbnailHTML() + |
98 | 98 | '</div>'+ |
99 | 99 | '</div>' |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_vlcEmbed.js |
— | — | @@ -211,7 +211,12 @@ |
212 | 212 | this.duration = this.vlc.input.length /1000; |
213 | 213 | }*/ |
214 | 214 | //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 | + } |
216 | 221 | if( this.duration > 0 || this.vlc.input.time > 0){ |
217 | 222 | this.start_offset=this.media_element.selected_source.start_offset; |
218 | 223 | |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/mv_sequence.css |
— | — | @@ -95,16 +95,17 @@ |
96 | 96 | .mv_clip_list_result{ |
97 | 97 | padding:10px; |
98 | 98 | } |
99 | | -.mv_time_clip{ |
| 99 | +.mv_storyboard_container{ |
100 | 100 | position:absolute; |
101 | 101 | z-index:0; |
102 | 102 | overflow:hidden; |
103 | | - border:solid thin white; |
104 | 103 | } |
105 | 104 | .mv_clip_thumb{ |
106 | 105 | position:absolute; |
107 | 106 | top:7px; |
108 | | - border:solid thin #BBB; |
| 107 | + border:solid #CCC; |
| 108 | + display:block; |
| 109 | + overflow:hidden; |
109 | 110 | } |
110 | 111 | .mv_tl_clip{ |
111 | 112 | position:absolute; |
— | — | @@ -117,5 +118,16 @@ |
118 | 119 | white-space: nowrap; |
119 | 120 | } |
120 | 121 | .mv_selected_clip{ |
121 | | - border:solid thin #9F9; |
| 122 | + border:solid #9F9; |
122 | 123 | } |
| 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 @@ |
279 | 279 | width: 14px; |
280 | 280 | height: 14px; |
281 | 281 | position: relative; |
282 | | - z-index: 5; |
| 282 | + z-index: 6; |
283 | 283 | margin: -13px 0 0 0px; |
284 | 284 | cursor: pointer; |
285 | 285 | } |
— | — | @@ -463,6 +463,12 @@ |
464 | 464 | float: right; |
465 | 465 | display: inline; |
466 | 466 | } |
| 467 | +.cl_status{ |
| 468 | + position:absolute; |
| 469 | + height:12px; |
| 470 | + top:0px; |
| 471 | + z-index:5; |
| 472 | +} |
467 | 473 | |
468 | 474 | #SEQUENCER CSS: |
469 | 475 | #resizable css: |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js |
— | — | @@ -2234,7 +2234,7 @@ |
2235 | 2235 | var etime_parts = times[1].split(':'); |
2236 | 2236 | |
2237 | 2237 | var new_anno_track_url = annoURL.protocol +'://'+ annoURL.host + annoURL.path +'?'; |
2238 | | - for(i in annoURL.queryKey){ |
| 2238 | + for(var i in annoURL.queryKey){ |
2239 | 2239 | new_anno_track_url +=(i=='t')?'t='+new_start+'/'+new_end +'&' : |
2240 | 2240 | i+'='+ annoURL.queryKey[i]+'&'; |
2241 | 2241 | } |
— | — | @@ -2461,9 +2461,13 @@ |
2462 | 2462 | my_thumb_src = getUpdateTimeURL( my_thumb_src, time_ntp, options.size ); |
2463 | 2463 | } |
2464 | 2464 | 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 +'" '+ |
2466 | 2466 | '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>'; |
2468 | 2472 | }, |
2469 | 2473 | updateThumbTime:function( float_sec ){ |
2470 | 2474 | var _this = this; |
— | — | @@ -2820,7 +2824,7 @@ |
2821 | 2825 | * there is no general way to pause the video |
2822 | 2826 | * must be overwritten by embed object to support this functionality. |
2823 | 2827 | */ |
2824 | | - pause : function(){ |
| 2828 | + pause: function(){ |
2825 | 2829 | js_log('mv_embed:do pause'); |
2826 | 2830 | var this_id = (this.pc!=null)?this.pc.pp.id:this.id; |
2827 | 2831 | //(playing) do pause |
— | — | @@ -2828,7 +2832,7 @@ |
2829 | 2833 | //update "paused state" |
2830 | 2834 | $j("#mv_play_pause_button_"+this_id).attr('class', 'play_button'); |
2831 | 2835 | }, |
2832 | | - play_or_pause : function(){ |
| 2836 | + play_or_pause: function(){ |
2833 | 2837 | js_log('embed:f:play_or_pause'); |
2834 | 2838 | //check state and set play or pause |
2835 | 2839 | if(this.paused){ |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_sequencer.js |
— | — | @@ -69,7 +69,6 @@ |
70 | 70 | |
71 | 71 | base_adj_duration:.5, //default time to subtract or add when adjusting clips. |
72 | 72 | |
73 | | - |
74 | 73 | //Msg are all the language specific values ... |
75 | 74 | // (@@todo overwrite by msg values preloaded in the page) |
76 | 75 | //tack/clips can be pushed via json or inline playlist format |
— | — | @@ -95,6 +94,7 @@ |
96 | 95 | 'options':0 |
97 | 96 | //menu_resource_overview |
98 | 97 | }, |
| 98 | + multi_clip_select:false, //controls the multi-clip select state |
99 | 99 | init:function( initObj ){ |
100 | 100 | //set the default values: |
101 | 101 | for(var i in sequencerDefaultValues){ |
— | — | @@ -189,7 +189,7 @@ |
190 | 190 | req_url+='|'+i; |
191 | 191 | $j('#'+i+'_ic').html( getMsg('loading_txt') );//set targets to loading |
192 | 192 | } |
193 | | - var _this = this; |
| 193 | + var this_seq = this; |
194 | 194 | do_request(req_url, function(data){ |
195 | 195 | if(typeof data=='string'){ |
196 | 196 | js_log(' eval data: ' + data); |
— | — | @@ -199,12 +199,12 @@ |
200 | 200 | for(var i in data){ |
201 | 201 | js_log('set '+ i + ' to: '+ data[i] ); |
202 | 202 | $j('#'+i+'_ic').html( data[i] ); |
203 | | - _this.doMenuItemDispJs(i) |
| 203 | + this_seq.doMenuItemDispJs(i) |
204 | 204 | } |
205 | 205 | }); |
206 | 206 | }, |
207 | 207 | doMenuItemDispJs:function(item){ |
208 | | - var _this = this; |
| 208 | + var this_seq = this; |
209 | 209 | var target_id = item + '_ic'; |
210 | 210 | //do any menu item post embed js hook processing: |
211 | 211 | switch(item){ |
— | — | @@ -220,9 +220,9 @@ |
221 | 221 | return js_log( 'Error:missing interface_url, can not load search interface' ); |
222 | 222 | |
223 | 223 | 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', |
227 | 227 | 'target_input':'mv_ams_search', |
228 | 228 | 'target_submit':'mv_ams_submit', |
229 | 229 | 'target_results':'mv_ams_results' |
— | — | @@ -231,15 +231,15 @@ |
232 | 232 | break; |
233 | 233 | case 'options': |
234 | 234 | $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 |
236 | 236 | }).click(function(){ |
237 | | - _this.doSimpleTl(); |
| 237 | + this_seq.doSimpleTl(); |
238 | 238 | }); |
239 | 239 | $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 | + }); |
244 | 244 | break; |
245 | 245 | } |
246 | 246 | }, |
— | — | @@ -325,8 +325,7 @@ |
326 | 326 | ); |
327 | 327 | //also render the clips in the trackset container: (thumb or text view) |
328 | 328 | $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" />' |
331 | 330 | ); |
332 | 331 | top_pos+=track_height+20; |
333 | 332 | } |
— | — | @@ -338,7 +337,7 @@ |
339 | 338 | var track_height=this.track_clipThumb_height; |
340 | 339 | //add in play box and container tracks |
341 | 340 | $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">' + |
343 | 342 | '</div>' |
344 | 343 | ); |
345 | 344 | top_pos+=track_height+20; |
— | — | @@ -391,6 +390,35 @@ |
392 | 391 | //render the timeline |
393 | 392 | this.renderTimeLine(); |
394 | 393 | 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 | + }); |
395 | 423 | }, |
396 | 424 | update_tl_hook:function(jh_time_ms){ |
397 | 425 | //put into seconds scale: |
— | — | @@ -528,28 +556,27 @@ |
529 | 557 | $j('#modal_window').hide(); |
530 | 558 | $j('#modalbox').show(); |
531 | 559 | }, |
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); |
534 | 562 | 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(){ |
543 | 572 | //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 | + //} |
554 | 581 | }, |
555 | 582 | doEdit:function( editObj ){ |
556 | 583 | //add the current editObj to the edit stack (should allow for "undo") |
— | — | @@ -651,11 +678,10 @@ |
652 | 679 | clip.width_px = container_width; |
653 | 680 | var base_id = 'track_'+track_id+'_clip_'+j; |
654 | 681 | 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="'+ |
658 | 684 | 'left:'+clip.left_px+'px;'+ |
659 | | - 'height:' + (this.track_clipThumb_height+20) + 'px;' + |
| 685 | + 'height:' + (this.track_clipThumb_height+30) + 'px;' + |
660 | 686 | 'width:'+(container_width)+'px;" >'; |
661 | 687 | track_html+=clip.embed.renderTimelineThumbnail({ |
662 | 688 | 'width':frame_width, |
— | — | @@ -670,10 +696,10 @@ |
671 | 697 | track_html+='<div style="" id="tb_' + base_id + '" class="clip_trans_box"/>'; |
672 | 698 | |
673 | 699 | //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>'+ |
678 | 704 | '</div>'; |
679 | 705 | track_html+='</span>'; |
680 | 706 | |
— | — | @@ -702,7 +728,7 @@ |
703 | 729 | //add in per clip controls |
704 | 730 | 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"; |
705 | 731 | 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"; |
707 | 733 | track_html+='<span style="display:none;" class="mv_clip_stats"></span>'; |
708 | 734 | |
709 | 735 | track_html+='</span>'; |
— | — | @@ -725,11 +751,22 @@ |
726 | 752 | |
727 | 753 | //apply onClick edit controls: |
728 | 754 | $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"); |
731 | 768 | $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'); |
734 | 771 | $j('#' + $j(this).parent().attr("id") + '_adj').fadeIn("fast"); |
735 | 772 | } |
736 | 773 | }); |
— | — | @@ -996,8 +1033,7 @@ |
997 | 1034 | this.playline_time = jh_time; |
998 | 1035 | js_log('time: ' + seconds2ntp(jh_time) + ' ' + Math.round(jh_time/this.timeline_scale)); |
999 | 1036 | //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' ); |
1002 | 1038 | cur_pl_time=0; |
1003 | 1039 | //update the thumb with the requested time: |
1004 | 1040 | this.plObj.updateThumbTime( jh_time ); |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js |
— | — | @@ -547,6 +547,8 @@ |
548 | 548 | $j('#clipDesc_'+this.cur_clip.id).hide(); |
549 | 549 | this.cur_clip=new_clip; |
550 | 550 | $j('#clipDesc_'+this.cur_clip.id).show(); |
| 551 | + //update the playhead: |
| 552 | + this.setSliderValue( this.cur_clip.dur_offset / this.getDuration() ); |
551 | 553 | }, |
552 | 554 | prev: function(){ |
553 | 555 | //advance the playhead to the previous clip |
— | — | @@ -715,19 +717,13 @@ |
716 | 718 | var pwidth = Math.round( perc * _this.track_len); |
717 | 719 | //var pwidth = Math.round( perc * _this.track_len - (_this.mv_seeker_width*perc) ); |
718 | 720 | |
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="' + |
721 | 722 | 'left:'+cur_pixle +'px;'+ |
722 | | - 'width:'+pwidth + 'px;'+ |
723 | | - 'height:12px;'+ |
724 | | - 'top:0px;'+ |
725 | | - 'z-index:1;'; |
| 723 | + 'width:'+pwidth + 'px;'; |
726 | 724 | //set left or right border based on track pos |
727 | 725 | barHtml+=( i == _this.default_track.getClipCount()-1 )? |
728 | 726 | 'border-left:solid thin black;': |
729 | | - 'border-right:solid thin black;'; |
730 | | - |
731 | | - |
| 727 | + 'border-right:solid thin black;'; |
732 | 728 | barHtml+= 'filter:alpha(opacity=40);'+ |
733 | 729 | '-moz-opacity:.40;">' |
734 | 730 | '</div>'; |