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},
$pathslashed=~s{^.*/}{};
$pathslashed=~tr{-}{/};
my $streamlisturl="http://$pathslashed";
-for (;;) {
-
+my $tried;
+do {
sub streamlist_get($)
{
my($streamlist)=@_;
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(
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,@ARGV;
+ 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);