Ignore:
Timestamp:
1999-06-30T15:36:35+12:00 (25 years ago)
Author:
sjboddie
Message:

Added maxdocs option

File:
1 edited

Legend:

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

    r285 r317  
    1 # plugin which recurses through directories processing
    2 # each file it finds
     1# plugin which recurses through an archives.inf file
     2# (i.e. the file generated in the archives directory
     3# when an import is done), processing each file it finds
    34
    45package ArcPlug;
     
    2728}
    2829
    29 # return 1 if processed, 0 if not processed
     30# return number of files processed, undef if can't process
    3031# Note that $base_dir might be "" and that $file might
    3132# include directories
    3233sub read {
    3334    my $self = shift (@_);
    34     ($pluginfo, $base_dir, $file, $metadata, $processor) = @_;
    35 #    my $count = 0;
     35    ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs) = @_;
     36
     37    my $count = 0;
    3638
    3739    # see if this has a archives information file within it
     
    3941
    4042    if (-e $archive_info_filename) {
     43
     44    # found an archives.inf file
     45    print STDERR "ArcPlug: processing $archive_info_filename\n";
    4146
    4247    # read in the archives information file
     
    4853    # process each file
    4954    foreach $subfile (@$file_list) {
    50 ####        # note: metadata is not carried on to the next level - why ??? - I changed this
    51         # so I could pass the classifytype from mgbuilder - Stefan.
     55        last if (defined $maxdocs && $maxdocs =~ /\d/ && $count >= $maxdocs);
     56
    5257        my $tmp = &util::filename_cat ($file, $subfile->[0]);
    5358        next if $tmp eq $file;
    54         &plugin::read ($pluginfo, $base_dir, $tmp, $metadata, $processor);
    55 #       $count ++;
    56 #       last if $count > 200;
    57     }
    58    
    59     # all books have been processed so need to output classifications
    60     # to infodb - note that at present you have to import before building
    61     if (defined $processor->{'mode'} && $processor->{'mode'} eq 'infodb') {
    62         print STDERR "ArcPlug: Adding classifications to infodb\n";
    63         $processor->process('classifications');
     59        # note: metadata is not carried on to the next level
     60        $count += &plugin::read ($pluginfo, $base_dir, $tmp, {}, $processor, $maxdocs);
    6461    }
    6562
    66     return 1;
     63    return $count;
    6764    }
    6865
    6966    # wasn't an archives directory, someone else will have to process it
    70     return 0;
     67    return undef;
    7168}
    7269
Note: See TracChangeset for help on using the changeset viewer.