Changeset 18555

Show
Ignore:
Timestamp:
20.02.2009 11:04:15 (11 years ago)
Author:
davidb
Message:

General tidy up of code for supporting cached files. The generate_cached_images plugin option has been changed to enable_cache as this makes more sense for the other media formats we are begining to support, such as audio and video

Location:
gsdl/trunk/perllib
Files:
2 removed
5 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/classify/BaseClassifier.pm

    r18508 r18555  
    308308    foreach my $existing_oid (@{$self->{$field}}) { 
    309309    if ($existing_oid eq $delete_oid) { 
    310         print $outhandle "  Deleting $delete_oid for ", ref $self, "\n"; 
     310        print $outhandle "  Deleting old $delete_oid for ", ref $self, "\n"; 
    311311    } 
    312312    else { 
     
    324324    my $outhandle = $self->{'outhandle'}; 
    325325 
    326     print $outhandle "  Deleting $delete_oid for ", ref $self, "\n"; 
     326    print $outhandle "  Deleting old $delete_oid for ", ref $self, "\n"; 
    327327    delete $self->{$field}->{$delete_oid}; 
    328328} 
  • gsdl/trunk/perllib/convertutil.pm

    r18474 r18555  
    9999    # Default are provided for these monitor functions if none specified 
    100100 
     101 
    101102    my $verbosity = $options->{'verbosity'}; 
    102103    my $outhandle = $options->{'outhandle'}; 
     
    257258    my ($command,$ofilename,$options) = @_; 
    258259 
     260    my $outhandle = $options->{'outhandle'}; 
     261    my $verbosity = $options->{'verbosity'}; 
     262    my $message_prefix = $options->{'message_prefix'}; 
     263 
    259264    my $regenerated = 0; 
    260265    my $result = ""; 
    261266    my $had_error = 0; 
     267 
     268    my $args_filename = "$ofilename.args"; 
    262269 
    263270    if (!-e $ofilename) { 
     
    265272        = regenerate_general_cmd($command,$ofilename,$options); 
    266273    } 
     274    elsif (-M $ofilename > -M $args_filename) { 
     275    # Source files has been updated/changed in some way 
     276    # => regenerate 
     277    print $outhandle "$ofilename modified more recently than cached version\n"; 
     278 
     279    ($regenerated,$result,$had_error)  
     280        = regenerate_general_cmd($command,$ofilename,$options);  
     281    } 
    267282    else { 
    268283    # file exists => check to see if command to generate it has changed 
    269     my $args_filename = "$ofilename.args"; 
     284 
    270285    if (open (ARGSIN,"<$args_filename")) { 
    271286        my $prev_command = <ARGSIN>; 
     
    282297        } 
    283298        else { 
    284             my $outhandle = $options->{'outhandle'}; 
    285             my $verbosity = $options->{'verbosity'}; 
    286  
    287             my $message_prefix = $options->{'message_prefix'}; 
    288  
    289299            my ($ofile) = ($ofilename =~ m/^.*(cached.*)$/); 
    290300 
     
    310320    } 
    311321    else { 
    312         my $outhandle = $options->{'outhandle'}; 
    313         my $message_prefix = $options->{'message_prefix'}; 
    314          
    315322        print $outhandle "  $message_prefix: No cached previous args found.  Regenerating $ofilename\n"; 
    316323 
  • gsdl/trunk/perllib/plugins/BaseMediaConverter.pm

    r18465 r18555  
    4040 
    4141my $arguments = [ 
     42      { 'name' => "enable_cache", 
     43    'desc' => "{BaseMediaConverter.enable_cache}", 
     44    'type' => "flag", 
     45    'reqd' => "no", 
     46    } 
     47 
    4248         ]; 
    4349 
     
    154160 
    155161 
     162sub run_uncached_general_cmd 
     163{ 
     164    my $self = shift @_; 
     165 
     166    my ($command,$ofilename,$print_info) = @_; 
     167 
     168    return $self->run_general_cmd($command,$print_info); 
     169} 
     170 
     171 
     172 
    156173sub run_cached_general_cmd 
    157174{ 
     
    183200    my $had_error; 
    184201 
    185     if ($self->{'cache_generated_images'}) { 
     202    if ($self->{'enable_cache'}) { 
    186203    ($regenerated,$result,$had_error) 
    187204        = $self->run_cached_general_cmd($command,$ofilename,$print_info); 
  • gsdl/trunk/perllib/plugins/ImageConverter.pm

    r18526 r18555  
    8989    'deft' => "100", 
    9090    'range' => "1,", 
    91     'reqd' => "no" }, 
    92       { 'name' => "cache_generated_images", 
    93     'desc' => "{ImageConverter.cache_generated_images}", 
    94     'type' => "flag", 
    95     'reqd' => "no", 
    96     } 
     91    'reqd' => "no" } 
    9792         ]; 
    9893 
  • gsdl/trunk/perllib/strings.properties

    r18517 r18555  
    905905HTMLPlugin.old_style_HDL:To mark whether the file in this collection used the old HDL document's tags style.  
    906906 
    907 ImageConverter.cache_generated_images:Cache thumbnails and screenview images so they don't need to be repeatedly generated. 
     907BaseMediaConverter.enable_cache:Cache automatically generated files (such as thumbnails and screen-size images) so they don't need to be repeatedly generated. 
    908908 
    909909ImageConverter.converttotype:Convert main image to format 's'.