Changeset 24419


Ignore:
Timestamp:
2011-08-17T18:52:58+12:00 (11 years ago)
Author:
ak19
Message:
  1. Dr Bainbridge fixed another bug with the EmbeddedMetadataPlugin and its interaction with OAIPlugin: extracted metadata is now merged into any earlier extracted metadata table, so that ex.dc.* meta extracted by the OAIPlugin higher up in the plugin pipeline is preserved after EmbeddedMetaPlug is through with the file. 2. Removed recent PDFPlugin commit where can_process_this_file_for_metadata was overridden. It isn't needed and may have adverse effects.
Location:
main/trunk/greenstone2/perllib/plugins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/EmbeddedMetadataPlugin.pm

    r24414 r24419  
    281281    # Associate the metadata now
    282282
    283     $extrametadata->{$file} = \%exif_metadata;
    284     push(@$extrametakeys, $file);
     283    if (defined $extrametadata->{$file}) {
     284    print STDERR "\n****  Need to merge new metadata with existing stored metadata: file = $file\n" if $verbosity > 2;
     285
     286    my $file_metadata_table =     $extrametadata->{$file};
     287
     288    foreach my $metaname (keys %exif_metadata) {
     289        # will create new entry if one does not already exist
     290        push(@{$file_metadata_table->{$metaname}}, @{$exif_metadata{$metaname}});       
     291    }
     292
     293    # no need to push $file on to $extrametakeys as it is already in the list
     294    }
     295    else {
     296    $extrametadata->{$file} = \%exif_metadata;
     297    push(@$extrametakeys, $file);
     298    }
    285299
    286300}
  • main/trunk/greenstone2/perllib/plugins/PDFPlugin.pm

    r24414 r24419  
    213213}
    214214
    215 # Even if a plugin can extract metadata in its metadata_read pass,
    216 # make the default return 'undef' so processing of the file continues
    217 # down the pipeline, so other plugins can also have the opportunity to
    218 # locate metadata and set it up in the extrametakeys variables that
    219 # are passed around.
    220 sub can_process_this_file_for_metadata {
    221     my $self = shift(@_);
    222 
    223     # this plugin will look for metadata in any file through its
    224     # metadata_read(). Returning undef here means anything else further
    225     # down the pipeline can do the same
    226 
    227     return 0;
    228 }
    229 
    230215sub init {
    231216    my $self = shift (@_);
Note: See TracChangeset for help on using the changeset viewer.