Removed dupe mirror entry, updated horrible looping to make it less horrible, made output format not ruin page widths, etc
Jacob Appelbaum

Jacob Appelbaum commited on 2008-06-28 06:53:18
Zeige 1 geänderte Dateien mit 22 Einfügungen und 27 Löschungen.

... ...
@@ -4,6 +4,7 @@ use strict;
4 4
 use LWP::Simple;
5 5
 use LWP;
6 6
 use Date::Parse;
7
+use Date::Format;
7 8
 
8 9
 print "Creating LWP agent ($LWP::VERSION)...\n";
9 10
 my $lua = LWP::UserAgent->new(
... ...
@@ -94,22 +95,6 @@ my %m = (
94 95
             updateDate => "",
95 96
         },
96 97
 
97
-       mirror001 => {
98
-            orgName => "depthstrike.com",
99
-            isoCC => "CA",
100
-            subRegion => "NS",
101
-            region => "North America",
102
-            ipv4 => "True",
103
-            ipv6 => "False",
104
-            loadBalanced => "Unknown",
105
-            httpWebsiteMirror => "http://tor.depthstrike.com/",
106
-            ftpWebsiteMirror => "",
107
-            rsyncWebsiteMirror => "",
108
-            httpDistMirror => "http://tor.depthstrike.com/dist/",
109
-            rsyncDistMirror => "",
110
-            updateDate => "",
111
-        },
112
-
113 98
        mirror002 => {
114 99
             orgName => "hermetix.org",
115 100
             isoCC => "CA",
... ...
@@ -563,7 +548,7 @@ my %m = (
563 548
        mirror028 => {
564 549
             adminContact => "jeroen\@unfix.org",
565 550
             orgName => "sixx",
566
-            isoCC => "",
551
+            isoCC => "CH",
567 552
             subRegion => "",
568 553
             region => "Europe",
569 554
             ipv4 => "True",
... ...
@@ -624,19 +609,29 @@ open(OUT, "> $outFile") or die "Can't open $outFile: $!";
624 609
 # This is storted from last known recent update to unknown update times
625 610
 foreach my $server ( sort { $m{$b}{'updateDate'} <=> $m{$a}{'updateDate'}} keys %m ) {
626 611
 
627
-     # Country    Organisation    website mirror      dist/ mirror
628
-     print OUT "\n<tr>\n";
629
-     print OUT "    <td>$m{$server}{'isoCC'}</td>\n";
630
-     print OUT "    <td>$m{$server}{'orgName'}</td>\n";
631
-     print OUT "    <td>$m{$server}{'updateDate'}</td>\n";
632
-
633
-     foreach my $precious ( "httpWebsiteMirror", "ftpWebsiteMirror", 
634
-                            "rsyncWebsiteMirror","httpDistMirror",
635
-                            "rsyncDistMirror" )
612
+     my $time = ctime($m{$server}{'updateDate'});
613
+     chomp($time);
614
+print OUT <<"END";
615
+     \n<tr>\n
616
+         <td>$m{$server}{'isoCC'}</td>\n
617
+         <td>$m{$server}{'orgName'}</td>\n
618
+         <td>$time</td>\n
619
+END
620
+
621
+     my %prettyNames = (
622
+                        httpWebsiteMirror => "http",
623
+                        httpsWebsiteMirror => "https",
624
+                        ftpWebsiteMirror => "ftp",
625
+                        rsyncWebsiteMirror => "rsync",
626
+                        httpDistMirror => "http",
627
+                        httpsDistMirror => "https",
628
+                        rsyncDistMirrors => "rsync", );
629
+
630
+     foreach my $precious ( sort keys %prettyNames )
636 631
      {
637 632
         if ($m{$server}{"$precious"}) {
638 633
             print OUT "    <td><a href=\"" . $m{$server}{$precious} . "\">" .
639
-                      "$m{$server}{$precious}</a></td>\n";
634
+                      "$prettyNames{$precious}</a></td>\n";
640 635
         } else { print OUT "    <td> - </td>\n"; }
641 636
      }
642 637
 
643 638