Changeset 8512


Ignore:
Timestamp:
2004-11-11T14:05:18+13:00 (19 years ago)
Author:
chi
Message:

Add a new metadata_read method in the first pass in order to identify any specific or extra metadata sets, also provide a better solution for HTMLPlug to identify all the associated images file and stylesheet files.

File:
1 edited

Legend:

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

    r8090 r8512  
    157157    $self->{'parser'} = $parser;
    158158    $self->{'in_filename'} = 0;
    159    
    160     }
    161    
     159    }
     160
    162161    return bless $self, $class;
    163162}
     
    249248    my %extrametadata;               # maps from filespec to extra metadata keys
    250249    my @extrametakeys;               # keys of %extrametadata in order read
    251    
     250
    252251    if ($read_metadata_files) {
    253 
    254     # read the directory "metadata.xml" file
     252    #read the directory "metadata.xml" file
    255253    my $metadatafile = &util::filename_cat ($dirname, 'metadata.xml');
    256254    if (-e $metadatafile) {
     
    261259    }
    262260    }
    263 
     261   
    264262    # import each of the files in the directory
    265263    my $out_metadata;
    266264    my $num_files = scalar(@dir);
     265    for (my $i = 0; $i < scalar(@dir); $i++) {
     266    my $subfile = $dir[$i];
     267    my $this_file_base_dir = $base_dir;
     268    last if ($maxdocs != -1 && $count >= $maxdocs);
     269    next if ($subfile =~ /^\.\.?$/);
     270    #next if ($read_metadata_files && $subfile =~ /metadata\.xml$/);
     271
     272    # Recursively read each $subfile
     273    print $outhandle "RecPlug metadata recurring: $subfile\n" if ($verbosity > 2);
     274   
     275    $count += &plugin::metadata_read ($pluginfo, $this_file_base_dir,
     276                      &util::filename_cat($file, $subfile),
     277                      $out_metadata, \@extrametakeys, \%extrametadata,
     278                      $processor, $maxdocs, $gli);
     279    $additionalmetadata = 1;
     280    }
     281   
     282   
     283    # import each of the files in the directory
     284    $count=0;
    267285    for (my $i = 0; $i <= scalar(@dir); $i++) {
    268286    # When every file in the directory has been done, pause for a moment (figuratively!)
     
    293311        }
    294312        }
    295 
    296313        # When the new files have been processed, check again
    297314        $num_files = scalar(@dir);
     
    343360    # Next add metadata read in XML files (if it is supplied)
    344361    if ($additionalmetadata == 1) {
    345 
    346362        my ($filespec, $mdref);
    347363        foreach $filespec (@extrametakeys) {
     
    357373    # Recursively read each $subfile
    358374    print $outhandle "RecPlug recurring: $subfile\n" if ($verbosity > 2);
    359 
    360     $count += &plugin::read ($pluginfo, $this_file_base_dir, 
     375   
     376    $count += &plugin::read ($pluginfo, $this_file_base_dir,
    361377                 &util::filename_cat($file, $subfile),
    362378                 $out_metadata, $processor, $maxdocs, $gli);
    363379    }
    364380
    365     return $count;   
     381    return $count;
    366382}
    367383
     
    383399    $self->{'parser'}->parsefile($filename);
    384400    };
     401
    385402    if ($@) {
    386403    die "RecPlug: ERROR $filename is not a well formed metadata.xml file ($@)\n";
Note: See TracChangeset for help on using the changeset viewer.