Ignore:
Timestamp:
2018-10-08T23:57:39+13:00 (6 years ago)
Author:
Georgiy Litvinov
Message:

Workaround to set assign metadata via csv metadata plugin. "Section" column could be used in csv file to specify section for metadata to assign

File:
1 edited

Legend:

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

    r31492 r32501  
    212212    delete $csv_line_metadata{"Filename"};
    213213
     214    my $csv_line_section_array = $csv_line_metadata{"Section"};
     215    my $section_suffix = "";
     216    if (defined $csv_line_section_array) {
     217        my $section_value = shift(@$csv_line_section_array);
     218        if ($section_value =~ /[\d.]+/m){
     219            my $section_suffix = "///Section/" . $section_value;
     220            foreach my $metaname (keys %csv_line_metadata) {
     221                my $new_name = $metaname . $section_suffix;
     222                $csv_line_metadata{$new_name} = delete $csv_line_metadata{$metaname};
     223            }
     224        } else{
     225            unshift(@$csv_line_section_array, $section_value);
     226        }
     227    }
     228
    214229
    215230    # Associate the metadata now
Note: See TracChangeset for help on using the changeset viewer.