[BACK]Return to ServerTorrents.pl CVS log [TXT][DIR] Up to [local] / openbsd / OpenBSDTorrents

Diff for /openbsd/OpenBSDTorrents/ServerTorrents.pl between version 1.2 and 1.3

version 1.2, 2005/03/24 00:42:07 version 1.3, 2005/03/24 19:49:51
Line 13 
Line 13 
   
 %ENV = ();  %ENV = ();
   
   
 use YAML;  use YAML;
   
 my $url_torrents = 'http://openbsd.somedomain.net/dumptorrents.php';  my $url_torrents = 'http://openbsd.somedomain.net/dumptorrents.php';
Line 22 
Line 23 
 my $user = 'torrentup';  my $user = 'torrentup';
 my $pass = 'ssapword';  my $pass = 'ssapword';
   
   my @Sizes = ('', 'Ki', 'Mi', 'Gi', 'Ti');
 my $ua = LWP::UserAgent->new;  my $ua = LWP::UserAgent->new;
   
 my $response = $ua->get($url_torrents);  my $response = $ua->get($url_torrents);
Line 121 
Line 123 
                 return undef;                  return undef;
         }          }
   
           my $size = $t->total_size;
   
           my $i;
           while ($size > 1024) {
                   $size /= 1024;
                   $i++;
           }
           $size = sprintf('%.2f', $size);
           $size .= $Sizes[$i] . 'B';
   
         my $comment = $t->{comment};          my $comment = $t->{comment};
         $comment =~ s/\n.*$//s;          $comment =~ s/\n.*$//s;
   
         my ($filename) = $comment =~ /Files from ([^<]+)/;          my ($filename) = $comment =~ /Files from (.+)/;
         $filename =~ s#/# #g;          $filename =~ s#/# #g;
   
         $filename .= ' (' . $time . ')';          $comment  .= " [$size]";
           $filename .= " [$time]";
   
         my $response = $ua->post($url_upload, {          my $response = $ua->post($url_upload, {
                 username => $user,                  username => $user,

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>