Changeset 23759


Ignore:
Timestamp:
2011-03-02T16:18:22+13:00 (13 years ago)
Author:
davidb
Message:

Now that generalized exploding is coming on-line, some additional checks are needed. In this case, an exploded document will already have an original metadata field called Source. Detect this and retain its value under the metadata name OrigSource

File:
1 edited

Legend:

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

    r23561 r23759  
    434434    my $coverfile = $filename;
    435435    $coverfile =~ s/\.[^\\\/\.]+$/\.jpg/;
     436
    436437    if (!&util::fd_exists($coverfile)) {
    437438        $coverfile =~ s/jpg$/JPG/;
     
    961962#   print STDERR "****** saving Source as:             $url_encoded_filename\n";
    962963#    }
    963    
    964    
     964
     965    # In the case of converted files and (generalized) exploded documents, there
     966    # will already be a source filename => store as OrigSource before overriding
     967    my $orig_source = $doc_obj->get_metadata_element ($this_section, "Source");
     968    if ((defined $orig_source) && ($orig_source !~ m/^\s*$/)) {
     969    $doc_obj->set_utf8_metadata_element($this_section, "OrigSource", $orig_source);
     970    }
     971       
    965972    # Source is the UTF8 display name - not necessarily the name of the file on the system
    966973    $doc_obj->set_utf8_metadata_element($this_section, "Source", $url_encoded_filename);
     974
    967975   
    968976    my $renamed_raw_file = &util::rename_file($raw_file, $self->{'file_rename_method'});
     
    10221030
    10231031    # should we move this to read? What about secondary plugins?
    1024     my $pp_file = &util::prettyprint_file($base_dir,$file,$gli);
     1032    my $pp_file = &util::prettyprint_file($base_dir,$file,$gli);
    10251033    print STDERR "<Processing n='$file' p='$self->{'plugin_type'}'>\n" if ($gli);
    10261034    print $outhandle "$self->{'plugin_type'} processing $pp_file\n"
Note: See TracChangeset for help on using the changeset viewer.