Index: /extensions/gsdl-video/trunk/perllib/plugins/TimedHTMLPlugin.pm
===================================================================
--- /extensions/gsdl-video/trunk/perllib/plugins/TimedHTMLPlugin.pm	(revision 19784)
+++ /extensions/gsdl-video/trunk/perllib/plugins/TimedHTMLPlugin.pm	(revision 19785)
@@ -122,5 +122,5 @@
     my $metatable_store = {};
 
-    my $metatable_re = "<table([^>]*)>(.*?<p class=\"?Metadata\"?>.*?)<\\/table>";
+    my $metatable_re = "<table([^>]*)>(.*?<p[^>]+class=\"?Metadata\"?[^>]*>.*?)<\\/table>";
 
     if ($$textref =~ m/$metatable_re/gsi) {
@@ -216,4 +216,6 @@
     my $time_encoded_file = "$hh$mm$ss";
 
+    print STDERR "***** time endocde = $time_encoded\n";
+
     my $time_pos = $self->{'time_pos'};
     my $time_num = scalar(@{$self->{'time_seq'}});
@@ -291,135 +293,30 @@
 
 
+	# Embed link to allow video to stream from marked time event
 	if ($media_type eq "video") {
 
 	    # video excerpt
-
-	    my $encoded_file = "$media_dir\_$time_encoded_file.avi";
-
-	    my $ve_filename 
-		= &util::filename_cat($collect_dir,"media","video_excerpt",$encoded_file);
-
-	    if ($only_num < $only_limit) {
-		if (! -e $ve_filename) {
-		    # my $args = "-vcodec mpeg2video";
-		    my $args = "-vcodec msmpeg4";
 		    
-		    my $ve_cmd = "gsmpeg.sh -v 1 -i $src_filename $args -ss $time_encoded ";
-		    
-		    if (defined $excerpt_len) {
-			$ve_cmd .= "-t $excerpt_len ";
-		    }
-		    
-		    $ve_cmd .= $ve_filename;
-		    
-##		    print STDERR "$ve_cmd\n";
-		    
-##		    `$ve_cmd`;
-		}
-		    
-##		my $avi_url = "http://mcgonagall.cs.waikato.ac.nz:8201/gsdl/collect/hauraki2/media/video_excerpt/$media_dir\_$time_encoded_file.avi";
-		my $avi_url = "_httpprefix_/collect/hauraki2/media/video_excerpt/$media_dir\_$time_encoded_file.avi";
+	    $avi_html .= "<a class=\"mm\" href=\"javascript:videoplayerseek($hh,$mm,$ss)\"><img border=1 src=\"_httpvideoimages_/ivideo.gif\"></a>";
+
+	    # save 'time-stamp' as metadata???	       
+
+	}
+	
+	# Do similar for audio.
+	#   Obviously, pure audio needs to be handled here, but also
+	#   video (and link in to its audio track)
+
+	if ($media_type =~ m/^(video|audio)$/) {
+
 		
-##		$avi_html = "<a class=\"mm\" href=\"$avi_url\"><img border=1 src=\"_httpcimages_\/video5.gif\"></a>";
-		
-		
-		## my $stream_url = "_httpstreamserver_/$local_root.asf";
-##		my $stream_url = "http://mcgonagall.cs.waikato.ac.nz:8090/$local_root.avi";
-##		$avi_html .= "<a class=\"mm\" href=\"$stream_url\">Stream</a>";
-
-
-		## $avi_html .= "<a class=\"mm\" href=\"_httpcurrentdocumentwithvplayer_\"><img border=1 src=\"_httpcimages_\/video5.gif\"></a>";
-
-		$avi_html .= "<a class=\"mm\" href=\"javascript:videoplayerseek($hh,$mm,$ss)\"><img border=1 src=\"_httpcimages_\/video5.gif\"></a>";
-
-		# save 'time-stamp' as metadata???
-		
-
-
-	    }
-	    else {
-		$avi_html = "<img src=\"_httpcimages_\/video5.gif\">";
-	    }
-	}
-
-	if ($media_type =~ m/^(video|audio)$/) {
-
-	    # audio excerpt
-#	    my $encoded_file = "$media_dir\_$time_encoded_file.mp3";
-
-#	    ## my $src_file = "$media_root\_Tape$tape_num.avi";
-
-#	    #my $src_filename 
-#	    #	= &util::filename_cat($collect_dir,"media",$media_type ,$media_dir, $src_file);
-
-#	    my $ae_filename 
-#		= &util::filename_cat($collect_dir,"media","audio_excerpt",$encoded_file);
-
-
-	    if ($only_num < $only_limit) {
-
-		$excerpt_len = 120 if (!defined $excerpt_len); #######
-
-		my ($ae_cmd,$omp3_filename,$omp3_file) 
-		    = $self->audio_excerpt_cmd($src_filename,
-					       $hh,$mm,$ss,$excerpt_len);
-		
-		my $ae_options = { @{$self->{'ffmpeg_monitor'}},
-				   'message_prefix' => "Audio Excerpt",
-				   'message' => "Generating audio excerpt: $omp3_file" }; 
-		
-		my ($ae_regenerated,$ae_result,$ae_had_error)
-		    = $self->run_cached_general_cmd($ae_cmd,$omp3_filename,$ae_options);
-
-		push(@{$self->{'mp3_excerpts'}}, { 'omp3_file' => $omp3_file, 'omp3_filename' => $omp3_filename} );
-
-	    }
-
-
-
-
-	    #    if (! -e $ae_filename) {
-	    if ($only_num < $only_limit) {
-#		if (! -e $ae_filename) {
-		    
-#		    my $args = "-acodec mp3";
-		    
-#		    ## my $src_filename = "media/video/mirth/VTS_01_1.avi";
-#		    my $ae_cmd = "gsmpeg.sh -v 1 -i $src_filename $args -ss $time_encoded ";
-		    
-#		    if (defined $excerpt_len) {
-#			$ae_cmd .= "-t $excerpt_len ";
-#		    }
-		    
-#		    $ae_cmd .= $ae_filename;
-		    		    		    
-##		    print STDERR "$ae_cmd\n";
-		    
-##		    `$ae_cmd`;
-#		}
-		
-		
-##		my $mp3_url = "http://mcgonagall.cs.waikato.ac.nz:8201/gsdl/collect/hauraki2/media/audio_excerpt/$media_dir\_$time_encoded_file.mp3";
-#		my $mp3_url = "_httpprefix_/collect/hauraki2/media/audio_excerpt/$media_dir\_$time_encoded_file.mp3";
-	
 		my ($voa_root) = ($src_file =~ m/^(.*)\..*?$/);
 	
-		my $mp3_url = "javascript:audioexcerptplay('$voa_root','$hh','$mm','$ss')";
-
-#		my $mp3_url = "_httpcollection_/index/assoc/{If}{[assocfilepath],[assocfilepath],[parent(Top):assocfilepath]}/$media_dir\_$time_encoded_file.mp3";
-
-		$mp3_html = "<a class=\"mm\" href=\"$mp3_url\"><img border=1 src=\"_httpcimages_\/audio2.gif\"></a>";
+		my $mp3_url = "javascript:audioplayerseek($hh,$mm,$ss)";
+		$mp3_html = "<a class=\"mm\" href=\"$mp3_url\"><img border=1 src=\"_httpvideoimages_/iaudio.gif\"></a>";
 
 #		my $baseexcerpt_url = "_httpcollection_/index/assoc/{If}{[assocfilepath],[assocfilepath],[parent(Top):assocfilepath]}";
 		
-#####		$doc_obj->add_metadata ($section, "audioexcerpturl",$mp3_url);
-		
-		
 	    }
-	    else {
-		$mp3_html = "<img src=\"_httpcimages_\/audio2.gif\">";
-		
-	    }
-	}
     }
     else {
@@ -457,8 +354,11 @@
     my $media_root = $self->{'media_root'};
 
-    my $front_re = "<p class=Timing><span\\s+.*?>";
+
+
+    ##my $front_re = "<p class=Timing>(?:<span\\s+.*?>)?";
+    my $front_re = "<p[^>]+class=\"?Timing(?:-.*?)?\"?[^>]*>(?:<span\\s+.*?>)?";
     my $tape_re  = "T\\d+:";
     my $tt_re = "\\d\\d";
-    my $back_re = ".*?<\\/span>";
+    my $back_re = ".*?(?:<\\/span>\\s*)?(?:<\\/p>)";
 
     my $time_match_re = "$front_re$tt_re:$tt_re:$tt_re$back_re(?:\:$tt_re)?";
@@ -471,4 +371,6 @@
 
     my @time_seq = ($$textref =~ m/$time_match_re/sgi);
+
+    print STDERR "***** got ", scalar(@time_seq), " matches\n";
 
     # artifically add tape information into all time indexes
@@ -491,5 +393,9 @@
     $self->{'time_pos'} = 0;
 
-    $$textref =~ s/(<p class=Timing><span\s+.*?>)(T\d+:)? ?(\d\d):(\d\d):(\d\d)(?:\:\d\d)?.*?(<\/span>)/$self->timed_event($1,$2,$3,$4,$5,$6)/sgie;
+    # my $front_re = "<p[^>]+class=\"?Timing(?:-.*?)?\"?[^>]*>(?:<span\\s+.*?>)?";
+
+    $$textref =~ s/($front_re)(T\d+:)? ?(\d\d):(\d\d):(\d\d)(?:\:\d\d)?.*?((?:<\/span>)?\s*<\/p>)/$self->timed_event($1,$2,$3,$4,$5,$6)/sgie;
+
+    ##$$textref =~ s/(<p class=Timing><span\s+.*?>)(T\d+:)? ?(\d\d):(\d\d):(\d\d)(?:\:\d\d)?.*?(<\/span>)/$self->timed_event($1,$2,$3,$4,$5,$6)/sgie;
 
 
@@ -693,5 +599,5 @@
     my $video_excerpt_duration = $self->{'video_excerpt_duration'};
 
-    print STDERR "**** video duration (secs) = $total_dur_secs\n";
+    print STDERR "**** video/audio duration (secs) = $total_dur_secs\n";
 
 
@@ -781,6 +687,13 @@
     # FlowPlayerThermo.swf height+16 pixels
     # FlowPlayerWhite.swf  height+26 pixels
-    $doc_obj->add_metadata ($section, "flashwidth",    $video_width);
-    $doc_obj->add_metadata ($section, "flashheight",   $video_height + 22 + 100);
+    if ($media_type eq "audio") {
+	$doc_obj->add_metadata ($section, "flashwidth",    $video_width);
+	$doc_obj->add_metadata ($section, "flashheight",   22 + 100);
+    }
+    else {
+	$doc_obj->add_metadata ($section, "flashwidth",    $video_width);
+	$doc_obj->add_metadata ($section, "flashheight",   $video_height + 22 + 100);
+    }
+
     
     my $base_url = "_httpstreamserverprefix_/collect/[collection]/index/assoc/{If}{[assocfilepath],[assocfilepath],[parent(Top):assocfilepath]}/";
Index: /extensions/gsdl-video/trunk/perllib/plugins/VideoConverter.pm
===================================================================
--- /extensions/gsdl-video/trunk/perllib/plugins/VideoConverter.pm	(revision 19784)
+++ /extensions/gsdl-video/trunk/perllib/plugins/VideoConverter.pm	(revision 19785)
@@ -305,4 +305,5 @@
 
     my $s_opt = "";
+
     if ($video_width > $video_height) {
 	if ($video_width > $orig_size) {
@@ -392,5 +393,9 @@
     my $oflash_filename = &util::filename_cat($output_dir,$oflash_file);
 
-    my $s_opt = $self->optional_frame_scale($streaming_size,$video_width,$video_height);
+    my $s_opt = "";
+    if ($self->{'media_type'} ne "audio") {
+	$s_opt = $self->optional_frame_scale($streaming_size,$video_width,$video_height);
+    }
+
 
     my $exp_duration = $self->{'exp_duration'};
@@ -529,5 +534,6 @@
 
     my $collect = $ENV{'GSDLCOLLECTION'};
-    my $thumbloc = "$video_server$video_prefix/collect/$collect";
+
+    ## my $thumbloc = "$video_server$video_prefix/collect/$collect";
 
 
Index: /extensions/gsdl-video/trunk/perllib/plugins/VideoPlugin.pm
===================================================================
--- /extensions/gsdl-video/trunk/perllib/plugins/VideoPlugin.pm	(revision 19784)
+++ /extensions/gsdl-video/trunk/perllib/plugins/VideoPlugin.pm	(revision 19785)
@@ -38,7 +38,8 @@
 use MultimediaPlugin;
 use VideoConverter;
+use ReadXMLFile;
 
 sub BEGIN {
-    @VideoPlugin::ISA = ('MultimediaPlugin', 'VideoConverter');
+    @VideoPlugin::ISA = ('MultimediaPlugin', 'VideoConverter', 'ReadXMLFile');
 }
 
@@ -138,5 +139,5 @@
 			     'message' => "Extracting keyframes" }; 
     
-    $self->autorun_cached_general_cmd($keyframe_cmd,$okeyframe_filename,$keyframe_options);
+    $self->run_cached_general_cmd($keyframe_cmd,$okeyframe_filename,$keyframe_options);
     $self->parse_shot_xml();
     $self->associate_keyframes($doc_obj,$section);
@@ -524,5 +525,5 @@
 
 	($convertto_regenerated,$convertto_result,$convertto_error)
-	    = $self->autorun_cached_general_cmd($convertto_command,$filename,$convertto_options);
+	    = $self->run_cached_general_cmd($convertto_command,$filename,$convertto_options);
 						    
 	$type = $converttotype;
@@ -979,5 +980,6 @@
     my ($expat) = @_;
 
-    $self->close_document();
+    # ****
+    # $self->close_document();
 }
 
