Index: /main/trunk/greenstone2/perllib/plugins/MediainfoOGVPlugin.pm
===================================================================
--- /main/trunk/greenstone2/perllib/plugins/MediainfoOGVPlugin.pm	(revision 22400)
+++ /main/trunk/greenstone2/perllib/plugins/MediainfoOGVPlugin.pm	(revision 22401)
@@ -60,29 +60,16 @@
 }
 
-my $arguments  =  [ { 'name' => "assoc_field",
+my $arguments  =  
+    [ { 'name' => "process_exp",
+        'desc' => "{BasePlugin.process_exp}",
+        'type' => "regexp",
+        'deft' => &get_default_process_exp(),
+        'reqd' => "no" },
+      { 'name' => "assoc_field",
 	'desc' => "{MediainfoOGVPlugin.assoc_field}",
 	'type' => "string",
-	'deft' => "movie",
+	'deft' => "Movie",
 	'reqd' => "no" },
-      { 'name' => "file_format",
-	'desc' => "{MediainfoOGVPlugin.file_format}",
-	'type' => "string",
-	'deft' => "ogv",
-	'reqd' => "no" },
-      { 'name' => "mime_type",
-	'desc' => "{MediainfoOGVPlugin.mime_type}",
-	'type' => "string",
-	'deft' => "video/ogg",
-	'reqd' => "no" },
-      { 'name' => "srcicon",
-	'desc' => "{MediainfoOGVPlugin.srcicon}",
-	'type' => "string",
-	'deft' => "iconogg",
-	'reqd' => "no" },
-      { 'name' => "process_extension",
-	'desc' => "{MediainfoOGVPlugin.process_extension}",
-	'type' => "string",
-	'deft' => "ogv",
-	'reqd' => "no" } ];
+      ];
 
 my $options = { 'name'     => "MediainfoOGVPlugin",
@@ -103,8 +90,12 @@
     my $self = new BasePlugin($pluginlist, $inputargs, $hashArgOptLists);
 
-    # "-process_extension" is a simpler alternative to -process_exp for non-regexp people
-    if (!$self->{'process_exp'} && $self->{'process_extension'}) {
-	$self->{'process_exp'} = "\\." . $self->{'process_extension'} . "\$";
-    }
+    return bless $self, $class;
+}
+
+sub init {
+    my $self = shift(@_);
+    my ($verbosity, $outhandle, $failhandle) = @_;
+
+    $self->BasePlugin::init($verbosity, $outhandle, $failhandle);   
 
     # Check that Mediainfo is installed and available on the path (except for Windows 95/98)
@@ -116,7 +107,8 @@
     }
 
-    return bless $self, $class;
-}
-
+}
+sub get_default_process_exp {
+    return q^(?i)\.ogv$^;
+}
 
 # MediainfoOGVPlugin processing of doc_obj.
@@ -134,12 +126,42 @@
     # check the filename is okay - do we need this??
     if ($filename_full_path eq "" || $filename_no_path eq "") {
-        print $outhandle "UnknownPlugin: couldn't process \"$filename_no_path\"\n";
+        print $outhandle "MediainfoOGVPlugin: couldn't process \"$filename_no_path\"\n";
         return undef;
     }
 
+    # Add the file as an associated file ...
+    my $section = $doc_obj->get_top_section();
+    my $file_format = "ogv";
+    my $mime_type = "video/ogg";
+    my $assoc_field = $self->{'assoc_field'};
+
+    # The assocfilename is the url-encoded version of the utf8 filename
+    my $assoc_file = $doc_obj->get_assocfile_from_sourcefile();
+
+    $doc_obj->associate_file($filename_full_path, $assoc_file, $mime_type, $section);
+    $doc_obj->add_metadata ($section, "FileFormat", $file_format);
+    $doc_obj->add_metadata ($section, "dc.Format", $file_format);
+    $doc_obj->add_metadata ($section, "MimeType", $mime_type);
+    $doc_obj->add_utf8_metadata ($section, $assoc_field, $doc_obj->get_source()); # Source metadata is already in utf8
+
+    $doc_obj->add_metadata ($section, "srclink",
+                            "<a href=\"_httpprefix_/collect/[collection]/index/assoc/[assocfilepath]/[SourceFile]\">");
+    $doc_obj->add_metadata ($section, "srcicon", "_iconogg_");
+    $doc_obj->add_metadata ($section, "/srclink", "</a>");
+
+    # we have no text - add dummy text and NoText metadata
+    $self->add_dummy_text($doc_obj, $section);
+
+    if (defined $self->{'mediainfo_not_installed'}) {
+	# can't do any extracted
+	print STDERR "Mediainfo not installed, so can't extract metadata\n";
+	return 1;
+    }
+
+    
     # Retrieve the file metadata
     my $command = "mediainfo --inform=\"General;%Duration/String2%|%Duration%|%FileSize/String2%|%Performer%|%Title%|%Recorded_Date%|%Recorded/Location%|%Producer%|%Copyright%|%LICENSE%|%Publisher%\" \"$filename_full_path\"";
     print $outhandle "$command\n" if ($verbosity > 2);
-
+    
     # execute the mediainfo command and store the output of execution in $videodata
     # my $video_metadata = `$command`; # backticks operator way
@@ -149,15 +171,15 @@
     if (open(VMIN,"$command|")) {
         my $line;
-
+	
 	# we read a line of output at a time
         while (defined ($line=<VMIN>)) {
-        	#print STDERR "***** line = $line\n";
-
-	        $video_metadata .= $line;
+	    #print STDERR "***** line = $line\n";
+	    
+	    $video_metadata .= $line;
         }
-
+	
         close(VMIN);
     }
-
+    
     print $outhandle "$video_metadata\n" if ($verbosity > 2);
 
@@ -170,26 +192,8 @@
     print $outhandle "RESULT = $FormattedDuration\n$Duration\n$Filesize\n$Artist\n$Title\n$Date\n$Location\n$Organization\n$Copyright\n$License\n$Contact\n" if ($verbosity > 2);
     
-    # Add the file as an associated file ...
-    my $section = $doc_obj->get_top_section();
-    my $file_format = $self->{'file_format'} || "ogv";
-    my $mime_type = $self->{'mime_type'} || "video/ogg";
-    my $assoc_field = $self->{'assoc_field'} || "movie";
-
-    # The assocfilename is the url-encoded version of the utf8 filename
-    my $assoc_file = $doc_obj->get_assocfile_from_sourcefile();
-
-    $doc_obj->associate_file($filename_full_path, $assoc_file, $mime_type, $section);
-    $doc_obj->add_metadata ($section, "FileFormat", $file_format);
-    $doc_obj->add_metadata ($section, "dc.Format", $file_format);
-    $doc_obj->add_metadata ($section, "MimeType", $mime_type);
-    $doc_obj->add_utf8_metadata ($section, $assoc_field, $doc_obj->get_source()); # Source metadata is already in utf8
  
     $doc_obj->add_metadata ($section, "FormattedDuration", $FormattedDuration);
     $doc_obj->add_metadata ($section, "Duration", $Duration);
  
-    $doc_obj->add_metadata ($section, "srclink",
-                            "<a href=\"_httpprefix_/collect/[collection]/index/assoc/[assocfilepath]/[SourceFile]\">");
-    $doc_obj->add_metadata ($section, "srcicon", "_".$self->{'srcicon'}."_");
-    $doc_obj->add_metadata ($section, "/srclink", "</a>");
 
     $doc_obj->add_metadata($section,"FileSize",$Filesize);
@@ -211,8 +215,6 @@
     $doc_obj->add_utf8_metadata($section,"Contact",$Contact);
  
-    # we have no text - add dummy text and NoText metadata
-    $self->add_dummy_text($doc_obj, $section);
-
-#    print STDERR "\n\n**** END of MediainfoOGVPlugin\n\n";
+
+    #print STDERR "\n\n**** END of MediainfoOGVPlugin\n\n";
     
     return 1;
