/[swish]/trunk/spider/progspider
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/spider/progspider

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 84 by dpavlin, Sun Aug 29 21:19:13 2004 UTC revision 98 by dpavlin, Sun Apr 24 18:09:01 2005 UTC
# Line 7  use File::Which; Line 7  use File::Which;
7  my $collection;         # name which will be inserted  my $collection;         # name which will be inserted
8  my $path_add;           # add additional info in path  my $path_add;           # add additional info in path
9  my $verbose;  my $verbose;
10    my $exclude;
11    my $skip_output;
12    
13  #$verbose = 1;  #$verbose = 1;
14    
# Line 15  my $result = GetOptions( Line 17  my $result = GetOptions(
17          "path=s" => \$path_add,          "path=s" => \$path_add,
18          "verbose!" => \$verbose,          "verbose!" => \$verbose,
19          "debug!" => \$verbose,          "debug!" => \$verbose,
20            "exclude=s" => \$exclude,
21            "skipoutput!" => \$skip_output,
22  );  );
23    
24  my $dir = shift @ARGV || die "usage: $0 [dir]";  my $dir = shift @ARGV || die "usage: $0 [dir]";
# Line 38  find({ wanted => \&file, Line 42  find({ wanted => \&file,
42  sub dump_contents($$$) {  sub dump_contents($$$) {
43          my ($contents,$mtime,$path) = @_;          my ($contents,$mtime,$path) = @_;
44    
45          return if (! $contents);        # don't die on empty files          return unless ($contents);      # don't die on empty files
46    
47            if ($exclude && $path =~ m/$exclude/i) {
48                    print STDERR "skip: $path\n" if ($verbose);
49                    return;
50            }
51    
52          use bytes;          use bytes;
53          my $size = length $contents;          my $size = length $contents;
54    
55          print STDERR " [$size]" if ($verbose);          print STDERR " [$size]" if ($verbose);
56    
57            return if ($skip_output);
58    
59          # Output the document (to swish)          # Output the document (to swish)
60          print <<EOF;          print <<EOF;
61  Path-Name: $path  Path-Name: $path
# Line 62  sub file { Line 73  sub file {
73          my $path = $_;          my $path = $_;
74          my $contents;          my $contents;
75    
76            return if (-l $path);
77    
78          if ($pdftotext && -f $path && $path =~ m/\.pdf$/i) {          if ($pdftotext && -f $path && $path =~ m/\.pdf$/i) {
79    
80                  print STDERR "$path {converting}" if ($verbose);                  print STDERR "$path {converting}" if ($verbose);
# Line 111  sub file { Line 124  sub file {
124                  open(F,"$path") || die "can't open file: $path";                  open(F,"$path") || die "can't open file: $path";
125                  print STDERR "$path" if ($verbose);                  print STDERR "$path" if ($verbose);
126                  while(<F>) {                  while(<F>) {
127                          $contents .= "$_";                          $contents .= $_;
128                  }                  }
129                  $contents .= "\n\n";                  $contents .= "\n\n";
130    

Legend:
Removed from v.84  
changed lines
  Added in v.98

  ViewVC Help
Powered by ViewVC 1.1.26