Changeset 25742


Ignore:
Timestamp:
06/05/12 12:39:41 (9 years ago)
Author:
kjdon
Message:

change to use can_process_this_file instead of metadata_read to test whether we can process this file or not. Also added a few segment ouptput messages for gli

File:
1 edited

Legend:

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

    r23352 r25742  
    121121    $extrametakeys, $extrametadata, $extrametafile,
    122122    $processor, $gli, $aux) = @_;
    123 
    124     # returns 1 if matches process_exp
    125     my $matched = $self->SUPER::metadata_read($pluginfo, $base_dir, $file,
    126                           $block_hash,
    127                           $extrametakeys,
    128                           $extrametadata,
    129                           $extrametafile,
    130                           $processor, $gli, $aux);
    131     my $split_matched = undef;
    132 
    133     if ($matched) {
    134 
    135     my $outhandle = $self->{'outhandle'};
    136     my $filename = &util::filename_cat($base_dir, $file);
     123   
     124    # can we process this file??
     125    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
     126    return undef unless $self->can_process_this_file($filename_full_path);
     127
     128        my $outhandle = $self->{'outhandle'};
     129        my $filename = &util::filename_cat($base_dir, $file);
    137130
    138131    my $plugin_name = ref ($self);
     
    181174   
    182175    $self->{'split_segments'}->{$file} = \@segments;
    183     $split_matched = scalar(@segments);
    184     }
    185    
    186     return $split_matched;
     176   
     177    return  scalar(@segments);
    187178}
    188179
     
    263254    # do plugin specific processing of doc_obj
    264255    print $outhandle "segment $segment\n" if ($self->{'verbosity'});
     256    print STDERR "<Processing s='$segment' n='$file' p='$self->{'plugin_type'}'>\n" if ($gli);
    265257    $status = $self->process (\$segtext, $pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli);
    266258    if (!defined $status) {
    267         print $outhandle "WARNING - no plugin could process segment $segment of $file\n"
     259        print $outhandle "WARNING: no plugin could process segment $segment of $file\n"
    268260        if ($verbosity >= 2);
     261        print STDERR "<ProcessingError s='$segment' n='$file'>\n" if $gli;
    269262        next;
    270263    }
Note: See TracChangeset for help on using the changeset viewer.