=================================================================== RCS file: /cvs/openbsd/OpenBSDTorrents/NewTorrents.pl,v retrieving revision 1.7 retrieving revision 1.10 diff -u -r1.7 -r1.10 --- openbsd/OpenBSDTorrents/NewTorrents.pl 2005/05/02 22:47:48 1.7 +++ openbsd/OpenBSDTorrents/NewTorrents.pl 2006/07/24 19:03:53 1.10 @@ -1,5 +1,5 @@ #!/usr/bin/perl -T -#$Id: NewTorrents.pl,v 1.7 2005/05/02 21:47:48 andrew Exp $ +#$RedRiver: NewTorrents.pl,v 1.9 2006/05/15 18:47:04 andrew Exp $ use strict; use warnings; use diagnostics; @@ -17,22 +17,23 @@ use YAML; -# *** This requires --log-format="%t [%p] %o %f %l" on the rsync command my $last_dir = ''; while (<>) { chomp; - if (my ($year, $mon, $mday, $time, $pid, $oper, $file, $size) = - m#^(\d{4})/(\d{2})/(\d{2}) (\d{2}:\d{2}:\d{2}) \[(\d+)\] (\S+) (.+) (\d+)$# ) { - #print "($year, $mon, $mday, $time, $pid, $oper, $file, $size)\n"; - my ($dir, $file) = $file =~ m#^(.*)/([^/]+)#; - #print "$dir - $file\n"; + print $_, "\n"; + if (my ($message, $file) = m#(.*)\s+\`([^']+)'#) { + next if $message eq 'Making directory'; + + my $dir = ''; + if ($file =~ m#^(.*)/([^/]+)#) { + ($dir, $file) = ($1, $2); + } + #print "$message - $dir - $file\n"; if ($last_dir && $last_dir ne $dir) { StartTorrent($last_dir); } $last_dir = $dir; - } else { - #print $_; } } @@ -61,7 +62,7 @@ my $should_fork = 1; if ($dir eq 'skip') { - $dir = ''; + #$dir = ''; %Need_Update = (); $should_fork = 0; } else { @@ -87,12 +88,11 @@ } - chdir $OBT->{DIR_HOME} or die "Can't chdir to $OBT->{DIR_HOME}: $!"; - if (@now_update) { print "Making torrents for ", join(" ", @now_update), "\n"; } else { print "Remaking all torrents\n"; + push @now_update, $dir; } exec($OBT->{DIR_HOME} . '/regen.sh', @now_update); }