Changeset 16697

Show
Ignore:
Timestamp:
11.08.2008 14:04:23 (11 years ago)
Author:
kjdon
Message:

if marc mapping file cannot be located, print a warning about can't extract metadata but continue to process the file - get the record in the text so at least get something in the collection

Location:
gsdl/trunk/perllib/plugins
Files:
2 modified

Legend:

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

    r16692 r16697  
    128128    my $msg = "MARCPlugin ERROR: Can't locate mapping file \"" . 
    129129        $self->{'metadata_mapping_file'} . "\".\n " . 
    130         "    No marc files can be processed.\n"; 
     130        "    No metadata will be extracted from MARC files.\n"; 
    131131 
    132132    print $outhandle $msg; 
     
    190190    my ($filename, $encoding, $language, $textref) = @_; 
    191191 
     192    my $outhandle = $self->{'outhandle'}; 
     193     
     194    if (! defined($self->{'metadata_mapping'})) 
     195    { 
     196    # print a warning 
     197    print $outhandle "MARCPlugin: no metadata file! Can't extract metadata from $filename\n"; 
     198    } 
     199 
    192200    $self->{'readfile_encoding'}->{$filename} = $encoding; 
    193201 
     
    195203    if (!-r $filename) 
    196204    { 
    197     my $outhandle = $self->{'outhandle'}; 
    198205    print $outhandle "Read permission denied for $filename\n" if $self->{'verbosity'}; 
    199206    return; 
     
    243250    my $filename = &util::filename_cat($base_dir, $file); 
    244251 
    245     if (! defined($self->{'metadata_mapping'})) 
    246     { 
    247     print $outhandle "MARCPlugin: no metadata file! Can't process $file\n"; 
    248     return undef; 
    249     } 
    250  
    251252    my $cursection = $doc_obj->get_top_section(); 
    252253 
     
    259260    my $encoding = $self->{'readfile_encoding'}->{$filename}; 
    260261 
    261     if ($self->{'type'} ne "ascii" ){    
    262         $self->extract_metadata ($marc, $metadata, $encoding, $doc_obj, $cursection); 
    263     } 
    264     else{ 
    265     $self->extract_ascii_metadata ($$textref,$metadata,$doc_obj, $cursection); 
     262    if (defined ($self->{'metadata_mapping'}) ) { 
     263    if ($self->{'type'} ne "ascii" ){    
     264        $self->extract_metadata ($marc, $metadata, $encoding, $doc_obj, $cursection); 
     265    } 
     266    else{ 
     267        $self->extract_ascii_metadata ($$textref,$metadata,$doc_obj, $cursection); 
     268    } 
    266269    } 
    267270 
  • gsdl/trunk/perllib/plugins/MARCXMLPlugin.pm

    r16695 r16697  
    111111    my $msg = "MARCXMLPlugin ERROR: Can't locate mapping file \"" . 
    112112        $self->{'metadata_mapping_file'} . "\".\n " . 
    113         "    No marc files can be processed.\n"; 
     113        "    No metadata will be extracted from MARCXML files.\n"; 
    114114 
    115115    print $outhandle $msg; 
     
    206206 
    207207    my $outhandle = $self->{'outhandle'}; 
    208     print $outhandle "Record $self->{'record_count'} - MARCXMLPlugin: processing $self->{'file'}\n" if $self->{'verbosity'} > 1; 
     208    print $outhandle "Record $self->{'record_count'}\n" if $self->{'verbosity'} > 1;  
    209209 
    210210        $self->{'record_count'}++; 
     
    322322 
    323323    ## map the xmlmarc to gsdl metadata 
    324     if ($element eq "datafield" and defined $self->{'doc_obj'} and defined $self->{'marc_mapping'}){ 
     324    if ($element eq "datafield" and defined $self->{'doc_obj'} and defined $self->{'marc_mapping'} and defined $self->{'metadata_mapping'}){ 
    325325    my $metadata_mapping = $self->{'metadata_mapping'}; 
    326326    my $marc_mapping = $self->{'marc_mapping'};