]> git.sur5r.net Git - bacula/docs/commitdiff
update sourceforge to bacula.org download script
authorEric Bollengier <eric@eb.homelinux.org>
Mon, 23 Nov 2009 16:26:46 +0000 (17:26 +0100)
committerEric Bollengier <eric@eb.homelinux.org>
Mon, 23 Nov 2009 16:26:46 +0000 (17:26 +0100)
docs/tools/sf2bacula_downloads.pl

index 23e2dc17c138ec9940acefc66189a530d39ed744..57a78a0ad5c5b9783b45be0f52907ef23afd165d 100755 (executable)
@@ -51,11 +51,6 @@ while (my $l = <FP>)
 {
     #                                         cat   vers  file
     if ($l =~ m!href="(/projects/bacula/files/(.+?)/(.+?)/(.+?)/download)"!) {
-        if ($cur && $cur->{date} && !exists $seen{$cur->{file}}) {
-            push @{$cats{$cur->{cat}}}, $cur;
-            $seen{$cur->{file}} = 1;
-        }
-
         $cur = {
             dl  => $1,
             cat => $2,
@@ -65,7 +60,7 @@ while (my $l = <FP>)
     }
 
     # the size and the date are just after
-    if ($l =~ m!<td>([\d\.]+ [KMG]B)</td>!) {
+    if ($cur && $l =~ m!<td>([\d\.]+ [KMG]B)</td>!) {
         $cur->{size} = $1;
         do {
             $l = <FP>;
@@ -73,6 +68,13 @@ while (my $l = <FP>)
                 $cur->{date} = $1;
             }
         } while (!$cur->{date});
+
+        # once we have a full $cur element, we can store it
+        if (!exists $seen{$cur->{file}}) {
+            push @{$cats{$cur->{cat}}}, $cur;
+            $seen{$cur->{file}} = 1;
+            $cur = undef;
+        }
     }
 }
 close(FP);