Index: dl/trunk/perllib/baseconvert.pm
===================================================================
--- /gsdl/trunk/perllib/baseconvert.pm	(revision 18554)
+++ 	(revision )
@@ -1,137 +1,0 @@
-###########################################################################
-#
-# baseconvert.pm -- provides some fundamental methods for converting files
-#                    using external programming 
-#
-# Copyright (C) 1999 DigiLib Systems Limited, NZ
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-###########################################################################
-
-
-package baseconvert;
-
-use strict;
-no strict 'refs'; # allow filehandles to be variables and viceversa
-
-
-use convertutil;
-
-sub new {
-    my ($class) = shift @_;
-
-    my ($base_dir,$filename,$verbosity,$outhandle) = @_;
-
-    my $self = {};
-
-    $self->{'verbosity'}    = $verbosity;
-    $self->{'outhandle'}    = $outhandle;
-
-    # Work out relative filename within 'base_dir'
-    my ($file) = ($filename =~ m/^$base_dir(.*?)$/);
-    
-    $file =~ s/^\/|\\//; # get rid of leading slash from relative filename
-
-    # Setup cached_dir and file_root
-
-    my ($file_root, $dirname, $suffix)
-	= &File::Basename::fileparse($file, "\\.[^\\.]+\$");
-
-    my $collect_dir = $ENV{'GSDLCOLLECTDIR'};
-    my $base_output_dir = &util::filename_cat($collect_dir,"cached",$dirname);
-
-    if (!-e $base_output_dir ) {
-	print $outhandle "Creating directory $base_output_dir\n"
-	    if ($verbosity>2);
-
-	&util::mk_all_dir($base_output_dir);
-    }
-
-    my $output_dir = &util::filename_cat($base_output_dir,$file_root);
-
-    if (!-e $output_dir) {
-	print $outhandle "Creating directory $output_dir\n"
-	    if ($verbosity>2);
-
-	&util::mk_dir($output_dir);
-    }
-
-    $self->{'cached_dir'} = $output_dir;
-    $self->{'file_root'} = $file_root;
-    
-    return bless $self, $class;
-}
-
-
-
-sub run_general_cmd
-{
-    my $self = shift @_;
-    my ($command,$options) = @_;
-
-    if (!defined $options->{'verbosity'}) {
-	$options->{'verbosity'} = $self->{'verbosity'};
-    }
-
-    if (!defined $options->{'outhandle'}) {
-	$options->{'outhandle'} = $self->{'outhandle'};
-    }
-
-    
-    return &convertutil::run_general_cmd(@_);
-}
-
-
-sub regenerate_general_cmd
-{
-    my $self = shift @_;
-    my ($command,$ofilename,$options) = @_;
-
-    if (!defined $options->{'verbosity'}) {
-	$options->{'verbosity'} = $self->{'verbosity'};
-    }
-
-    if (!defined $options->{'outhandle'}) {
-	$options->{'outhandle'} = $self->{'outhandle'};
-    }
-
-    return &convertutil::regenerate_general_cmd(@_);
-}
-
-
-
-sub run_cached_general_cmd
-{
-    my $self = shift @_;
-
-    my ($command,$ofilename,$options) = @_;
-
-    if (!defined $options->{'verbosity'}) {
-	$options->{'verbosity'} = $self->{'verbosity'};
-    }
-
-    if (!defined $options->{'outhandle'}) {
-	$options->{'outhandle'} = $self->{'outhandle'};
-    }
-
-    return &convertutil::run_cached_general_cmd(@_);
-}
-
-
-
-
-
-1;
Index: /gsdl/trunk/perllib/classify/BaseClassifier.pm
===================================================================
--- /gsdl/trunk/perllib/classify/BaseClassifier.pm	(revision 18554)
+++ /gsdl/trunk/perllib/classify/BaseClassifier.pm	(revision 18555)
@@ -308,5 +308,5 @@
     foreach my $existing_oid (@{$self->{$field}}) {
 	if ($existing_oid eq $delete_oid) {
-	    print $outhandle "  Deleting $delete_oid for ", ref $self, "\n";
+	    print $outhandle "  Deleting old $delete_oid for ", ref $self, "\n";
 	}
 	else {
@@ -324,5 +324,5 @@
     my $outhandle = $self->{'outhandle'};
 
-    print $outhandle "  Deleting $delete_oid for ", ref $self, "\n";
+    print $outhandle "  Deleting old $delete_oid for ", ref $self, "\n";
     delete $self->{$field}->{$delete_oid};
 }
Index: /gsdl/trunk/perllib/convertutil.pm
===================================================================
--- /gsdl/trunk/perllib/convertutil.pm	(revision 18554)
+++ /gsdl/trunk/perllib/convertutil.pm	(revision 18555)
@@ -99,4 +99,5 @@
     # Default are provided for these monitor functions if none specified
 
+
     my $verbosity = $options->{'verbosity'};
     my $outhandle = $options->{'outhandle'};
@@ -257,7 +258,13 @@
     my ($command,$ofilename,$options) = @_;
 
+    my $outhandle = $options->{'outhandle'};
+    my $verbosity = $options->{'verbosity'};
+    my $message_prefix = $options->{'message_prefix'};
+
     my $regenerated = 0;
     my $result = "";
     my $had_error = 0;
+
+    my $args_filename = "$ofilename.args";
 
     if (!-e $ofilename) {
@@ -265,7 +272,15 @@
 	    = regenerate_general_cmd($command,$ofilename,$options);
     }
+    elsif (-M $ofilename > -M $args_filename) {
+	# Source files has been updated/changed in some way
+	# => regenerate
+	print $outhandle "$ofilename modified more recently than cached version\n";
+
+	($regenerated,$result,$had_error) 
+	    = regenerate_general_cmd($command,$ofilename,$options);	
+    }
     else {
 	# file exists => check to see if command to generate it has changed
-	my $args_filename = "$ofilename.args";
+
 	if (open (ARGSIN,"<$args_filename")) {
 	    my $prev_command = <ARGSIN>;
@@ -282,9 +297,4 @@
 		}
 		else {
-		    my $outhandle = $options->{'outhandle'};
-		    my $verbosity = $options->{'verbosity'};
-
-		    my $message_prefix = $options->{'message_prefix'};
-
 		    my ($ofile) = ($ofilename =~ m/^.*(cached.*)$/);
 
@@ -310,7 +320,4 @@
 	}
 	else {
-	    my $outhandle = $options->{'outhandle'};
-	    my $message_prefix = $options->{'message_prefix'};
-	    
 	    print $outhandle "  $message_prefix: No cached previous args found.  Regenerating $ofilename\n";
 
Index: dl/trunk/perllib/imageconvert.pm
===================================================================
--- /gsdl/trunk/perllib/imageconvert.pm	(revision 18554)
+++ 	(revision )
@@ -1,140 +1,0 @@
-###########################################################################
-#
-# imageconvert.pm -- utility to help convert image file 
-#                    used by ImagePlug, PagedImgPlug ...
-#
-# Copyright (C) 1999 DigiLib Systems Limited, NZ
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-###########################################################################
-
-
-package imageconvert;
-
-use strict;
-no strict 'refs'; # allow filehandles to be variables and viceversa
-
-
-use baseconvert;
-
-sub BEGIN {
-    @imageconvert::ISA = ('baseconvert');
-}
-
-
-
-# Discover the characteristics of an image file with the ImageMagick
-# "identify" command.
-
-sub identify { 
-    my ($image, $outhandle, $verbosity) = @_;
-
-    # Use the ImageMagick "identify" command to get the file specs
-    my $command = "identify \"$image\" 2>&1";
-    print $outhandle "$command\n" if ($verbosity > 2);
-    my $result = '';
-    $result = `$command`;
-    print $outhandle "$result\n" if ($verbosity > 3);
-
-    # Read the type, width, and height
-    my $type =   'unknown';
-    my $width =  'unknown';
-    my $height = 'unknown';
-
-    my $image_safe = quotemeta $image;
-    if ($result =~ /^$image_safe (\w+) (\d+)x(\d+)/) {
-	$type = $1;
-	$width = $2;
-	$height = $3;
-    }
-	
-    # Read the size
-    my $size = "unknown";
-    if ($result =~ m/^.* ([0-9]+)b/) {
-	$size = $1;
-    } elsif ($result =~ m/^.* ([0-9]+)kb/) {
-	$size = 1024 * $1;
-    }
-
-    print $outhandle "file: $image:\t $type, $width, $height, $size\n" 
-	if ($verbosity > 3);
-
-    # Return the specs
-    return ($type, $width, $height, $size);
-}
-
-
-
-
-sub new {
-    my ($class) = shift @_;
-
-    my ($base_dir,$image_filename,$verbosity,$outhandle) = @_;
-
-    my $self = new baseconvert($base_dir,$image_filename,$verbosity,$outhandle);
-    
-    return bless $self, $class;
-}
-
-
-sub stream_cmd_XXXX
-{
-    my $self = shift (@_);
-    my ($ivideo_filename,$video_width,$video_height,
-	$streaming_bitrate,$streaming_size, 
-	$opt_streaming_achan, $opt_streaming_arate) = @_;
-
-    my $streaming_achan 
-	= (defined $opt_streaming_achan) ? $opt_streaming_achan : 2;
-
-    my $streaming_arate 
-	= (defined $opt_streaming_arate) ? $opt_streaming_arate : 22050;
-
-    my $output_dir = $self->{'cached_dir'};
-    my $ivideo_root = $self->{'file_root'};
-
-    my $oflash_file = "${ivideo_root}_stream.flv";
-    my $oflash_filename = &util::filename_cat($output_dir,$oflash_file);
-
-    my $s_opt = $self->optional_frame_scale($streaming_size,$video_width,$video_height);
-
-    my $exp_duration = $self->{'exp_duration'};
-    my $t_opt = (defined $exp_duration) ? "-t $exp_duration" : "";
-
-    my $main_opts = "-y $t_opt";
-
-    my $stream_opts = "-b $streaming_bitrate $s_opt";
-    ### my $stream_opts = "-r 25 $s_opt";
-    $stream_opts .= " -ac $streaming_achan -ar $streaming_arate";
-    $stream_opts .= " -pass 1/2";
-
-    # -flags +ilme+ildct' and maybe '-flags +alt' for interlaced material, and try '-top 0/1'
-
-    my $all_opts = "$main_opts $stream_opts"; 
-    my $ffmpeg_cmd = "ffmpeg  -i \"$ivideo_filename\" $all_opts -y \"$oflash_filename\"";
-
-    return ($ffmpeg_cmd,$oflash_filename,$oflash_file);
-}
-
-
-
-
-
-
-
-
-
-1;
Index: /gsdl/trunk/perllib/plugins/BaseMediaConverter.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/BaseMediaConverter.pm	(revision 18554)
+++ /gsdl/trunk/perllib/plugins/BaseMediaConverter.pm	(revision 18555)
@@ -40,4 +40,10 @@
 
 my $arguments = [
+      { 'name' => "enable_cache",
+	'desc' => "{BaseMediaConverter.enable_cache}",
+	'type' => "flag",
+	'reqd' => "no",
+	}
+
 		 ];
 
@@ -154,4 +160,15 @@
 
 
+sub run_uncached_general_cmd
+{
+    my $self = shift @_;
+
+    my ($command,$ofilename,$print_info) = @_;
+
+    return $self->run_general_cmd($command,$print_info);
+}
+
+
+
 sub run_cached_general_cmd
 {
@@ -183,5 +200,5 @@
     my $had_error;
 
-    if ($self->{'cache_generated_images'}) {
+    if ($self->{'enable_cache'}) {
 	($regenerated,$result,$had_error)
 	    = $self->run_cached_general_cmd($command,$ofilename,$print_info);
Index: /gsdl/trunk/perllib/plugins/ImageConverter.pm
===================================================================
--- /gsdl/trunk/perllib/plugins/ImageConverter.pm	(revision 18554)
+++ /gsdl/trunk/perllib/plugins/ImageConverter.pm	(revision 18555)
@@ -89,10 +89,5 @@
 	'deft' => "100",
 	'range' => "1,",
-	'reqd' => "no" },
-      { 'name' => "cache_generated_images",
-	'desc' => "{ImageConverter.cache_generated_images}",
-	'type' => "flag",
-	'reqd' => "no",
-	}
+	'reqd' => "no" }
 		 ];
 
Index: /gsdl/trunk/perllib/strings.properties
===================================================================
--- /gsdl/trunk/perllib/strings.properties	(revision 18554)
+++ /gsdl/trunk/perllib/strings.properties	(revision 18555)
@@ -905,5 +905,5 @@
 HTMLPlugin.old_style_HDL:To mark whether the file in this collection used the old HDL document's tags style. 
 
-ImageConverter.cache_generated_images:Cache thumbnails and screenview images so they don't need to be repeatedly generated.
+BaseMediaConverter.enable_cache:Cache automatically generated files (such as thumbnails and screen-size images) so they don't need to be repeatedly generated.
 
 ImageConverter.converttotype:Convert main image to format 's'.
