Ignore:
Timestamp:
2008-07-14T14:57:38+12:00 (16 years ago)
Author:
kjdon
Message:

global block pass: read_block is no more, use can_process_this_file to see whether a file is for us or not. extra arg (block_hash) to read, read_into_doc_obj, metadata_read etc

File:
1 edited

Legend:

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

    r15880 r16392  
    101101sub read {
    102102    my $self = shift (@_);
    103     my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
     103    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
    104104    my $outhandle = $self->{'outhandle'};
    105105
    106     # check process_exp, block_exp, associate_ext etc
    107     my ($block_status,$filename) = $self->read_block(@_);   
    108     return $block_status if ((!defined $block_status) || ($block_status==0));
     106    # can we process this file??
     107    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
     108    return undef unless $self->can_process_this_file($filename_full_path);
    109109   
    110     my ($file_only) = $file =~ /([^\\\/]*)$/;
    111110    my $tmpdir = &util::get_tmp_filename ();
    112111    &util::mk_all_dir ($tmpdir);
    113112   
    114     print $outhandle "ZIPPlugin: extracting $file_only to $tmpdir\n"
     113    print $outhandle "ZIPPlugin: extracting $filename_no_path to $tmpdir\n"
    115114    if $self->{'verbosity'} > 1;
    116115   
     
    118117    my $cwd = cwd();
    119118    chdir ($tmpdir) || die "Unable to change to $tmpdir";
    120     &util::cp ($filename, $tmpdir);
     119    &util::cp ($filename_full_path, $tmpdir);
    121120   
    122121    if ($file =~ /\.bz$/i) {
    123     $self->bunzip ($file_only);
     122    $self->bunzip ($filename_no_path);
    124123    } elsif ($file =~ /\.bz2$/i) {
    125     $self->bunzip2 ($file_only);
     124    $self->bunzip2 ($filename_no_path);
    126125    } elsif ($file =~ /\.(zip|jar)$/i) {
    127     $self->unzip ($file_only);
     126    $self->unzip ($filename_no_path);
    128127    } elsif ($file =~ /\.tar$/i) {
    129     $self->untar ($file_only);
     128    $self->untar ($filename_no_path);
    130129    } else {
    131     $self->gunzip ($file_only);
     130    $self->gunzip ($filename_no_path);
    132131    }
    133132   
    134133    chdir ($cwd) || die "Unable to change back to $cwd";
    135134   
    136     my $numdocs = &plugin::read ($pluginfo, "", $tmpdir, $metadata, $processor, $maxdocs, $total_count, $gli);
     135    my $numdocs = &plugin::read ($pluginfo, "", $tmpdir, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli);
    137136    &util::rm_r ($tmpdir);
    138137   
Note: See TracChangeset for help on using the changeset viewer.