/[hyperestraier_wrappers]/trunk/perl/scripts/est-spider
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/perl/scripts/est-spider

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

revision 28 by dpavlin, Sat Sep 17 23:43:20 2005 UTC revision 29 by dpavlin, Sat Sep 17 23:55:09 2005 UTC
# Line 18  my $exclude; Line 18  my $exclude;
18    
19  #$verbose = 1;  #$verbose = 1;
20  my $debug = 0;  my $debug = 0;
21    my $force = 0;
22    
23  my $result = GetOptions(  my $result = GetOptions(
24          "collection=s" => \$collection,          "collection=s" => \$collection,
# Line 26  my $result = GetOptions( Line 27  my $result = GetOptions(
27          "debug!" => \$debug,          "debug!" => \$debug,
28          "exclude=s" => \$exclude,          "exclude=s" => \$exclude,
29          "node=s" => \$node_url,          "node=s" => \$node_url,
30            "force!" => \$force,
31  );  );
32    
33  my $dir = shift @ARGV || die "usage: $0 [dir]";  my $dir = shift @ARGV || die "usage: $0 [dir]";
# Line 99  sub dump_contents($$$$) { Line 101  sub dump_contents($$$$) {
101          # create a document object          # create a document object
102          my $doc = HyperEstraier::Document->new;          my $doc = HyperEstraier::Document->new;
103    
104          my $title = $1 if ($contents =~ m#<title>(.+)</title>#is);          my $title = $1 if ($contents =~ m#<title>(.+?)</title>#is);
105    
106          # chop long titles to 100 chars          # chop long titles to 100 chars
107          $title = substr($title, 0, 100) . '...' if ($title && length($title) > 100);          $title = substr($title, 0, 100) . '...' if ($title && length($title) > 100);
# Line 134  sub file { Line 136  sub file {
136          my $path = $_;          my $path = $_;
137          my $contents;          my $contents;
138    
139          return if (-l $path || $path =~ m#/.svn# || $path =~ m/(~|.bak)$/);          return if (! $force && -l $path || $path =~ m#/.svn# || $path =~ m/(~|.bak)$/);
140    
141          my $mtime = (stat($path))[9];          my $mtime = (stat($path))[9];
142          my $mtime_db = $db->get_doc_attr_by_uri("file:///$path", '@mtime') || -2;          my $mtime_db = $db->get_doc_attr_by_uri("file:///$path", '@mtime') || -2;
143    
144          if ($mtime == $mtime_db) {          if ($mtime == $mtime_db) {
145                  print STDERR "# same: $path $mtime\n" if ($verbose);                  print STDERR "# same: $path $mtime\n" if ($verbose);
146                  return;                  return unless($force);
147          } else {          } else {
148                  print STDERR "# changed: $path $mtime != $mtime_db\n" if ($debug);                  print STDERR "# changed: $path $mtime != $mtime_db\n" if ($debug);
149          }          }

Legend:
Removed from v.28  
changed lines
  Added in v.29

  ViewVC Help
Powered by ViewVC 1.1.26