Permit POST redirections for the new di.fm site layout.
authorlace <>
Sat, 16 Jun 2007 17:54:47 +0000 (17:54 +0000)
committerlace <>
Sat, 16 Jun 2007 17:54:47 +0000 (17:54 +0000)
Well, some other updates.

bin/engine-di.fm

index 1355b82..05e027a 100755 (executable)
@@ -36,6 +36,7 @@ sub paidget($$)
        my $ua=LWP::UserAgent->new() or die "UA: $!";
        my $jar=HTTP::Cookies->new() or die "jar: $!";
        $ua->cookie_jar($jar);
+       push @{$ua->requests_redirectable()},"POST";
        my $req=HTTP::Request->new(
                "POST",
                q{http://}.$site.q{/pro/login.php},
@@ -117,8 +118,8 @@ my $pathslashed=$0;
 $pathslashed=~s{^.*/}{};
 $pathslashed=~tr{-}{/};
 my $streamlisturl="http://$pathslashed";
-for (;;) {
-
+my $tried;
+do {
        sub streamlist_get($)
        {
                my($streamlist)=@_;
@@ -146,6 +147,9 @@ for (;;) {
        warn Dumper(\@streamlist);
        for my $stream (@streamlist) {
                if (my($host,$port)=($stream=~m{^http://(?:[^@]+@)?([^:/@]+)(?::(\d+))?})) {
+                       # blacklisted: too slow
+                       next if $host eq "81.92.172.3";
+                       $tried++;
                        $port||=80;
                        warn "Connecting {$host}:{$port}...\n";
                        my $tcp=IO::Socket::INET->new(
@@ -157,9 +161,15 @@ for (;;) {
                        close $tcp or die "Close TCP: $!";
                }
                my $mplayer="mplayer";
-               my @list=($mplayer,qw(-cache 512),$stream);
+               my @list=($mplayer);
+               if ($pathslashed=~m{/(\d+)k}) {
+                       push @list,"-cache",60*$1/8,"-cache-min",45;
+               }
+               push @list,$stream;
                warn Dumper(\@list);
-               system $mplayer @list;
+               #system $mplayer @list;
+               do { die "[$&] <$_>" if m{[^-a-zA-Z 0-9/:.@]}; } for @list;
+               system {"bash"} "bash","-c",join(" ",@list);
                exit 0 if $?;
        }
-}
+} while ($tried);