Changeset 1269


Ignore:
Timestamp:
2000-07-04T16:03:49+12:00 (24 years ago)
Author:
sjboddie
Message:

Added ZIPPlug plugin for handling input documents that have been compressed
and/or archived with zip, gzip, bzip or tar. Currently uses unix utilities
but is simple enough to extend (maybe use pkunzip for zip files on windows?)

Location:
trunk/gsdl
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/import.pl

    r1243 r1269  
    5656    print STDERR "                          directory -- use with care\n";
    5757    print STDERR "   -gzip                  Use gzip to compress resulting gml documents\n";
     58    print STDERR "                          (don't forget to include ZIPPlug in your plugin\n";
     59    print STDERR "                          list when building from compressed documents)\n";
    5860    print STDERR "   -maxdocs number        Maximum number of documents to import\n";
    5961    print STDERR "   -groupsize number      Number of GML documents to group into one file\n";
  • trunk/gsdl/perllib/plugins/GMLPlug.pm

    r1244 r1269  
    4949    my $self = shift (@_);
    5050
    51     return q^(?i)\.gml(\.gz)?$^;
     51    return q^(?i)\.gml?$^;
    5252}
    5353
     
    7272    $parent_dir = &util::filename_cat ($base_dir, $parent_dir);
    7373
    74     # all this gzip stuff should one day be replaced by a gzip/bzip/zip/tar
    75     # handling plugin
    76     my $gz = 0;
    77     if ($file =~ /\.gz$/i) {
    78     $gz = 1;
    79     }
    80 
    81     # read in the document - input is assumed throughout this plugin to already be utf8
    82     if ($gz) {
    83     if (!open (INFILE, "zcat $filename |")) {
    84         print STDERR "GMLPlug::read - zcat couldn't read $filename\n";
    85         return 0;
    86     }
    87     } else {
    88     if (!open (INFILE, $filename)) {
    89         print STDERR "GMLPlug::read - couldn't read $filename\n";
    90         return 0;
    91     }
     74    if (!open (INFILE, $filename)) {
     75    print STDERR "GMLPlug::read - couldn't read $filename\n";
     76    return 0;
    9277    }
    9378
Note: See TracChangeset for help on using the changeset viewer.