Ignore:
Timestamp:
2009-10-05T14:14:20+13:00 (15 years ago)
Author:
kjdon
Message:

set some things to help with incremental building - block_hash->metadata_files, so we know it a metadata file, and extrametafile so we know which file the metadata came from

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugins/MetadataCSVPlugin.pm

    r20000 r20771  
    7474{
    7575    return q^(?i)\.csv$^;
     76}
     77
     78sub file_block_read {
     79    my $self = shift (@_);
     80    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $gli) = @_;
     81
     82    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
     83
     84    if (!-f $filename_full_path || !$self->can_process_this_file($filename_full_path)) {
     85    return undef; # can't recognise
     86    }
     87
     88    # set this so we know this is a metadata file - needed for incremental
     89    # build
     90    # if this file changes, then we need to reimport everything
     91    $block_hash->{'metadata_files'}->{$filename_full_path} = 1;
     92
     93    return 1;
    7694}
    7795
     
    175193    $extrametadata->{$csv_line_filename} = \%csv_line_metadata;
    176194    push(@$extrametakeys, $csv_line_filename);
     195    # record which file the metadata came from
     196    if (!defined $extrametafile->{$csv_line_filename}) {
     197        $extrametafile->{$csv_line_filename} = {};
     198    }
     199    # maps the file to full path
     200    $extrametafile->{$csv_line_filename}->{$file} = $filename;
    177201    }
    178202}
Note: See TracChangeset for help on using the changeset viewer.