X-Git-Url: https://git.jankratochvil.net/?p=nethome.git;a=blobdiff_plain;f=bin%2Fengine-di.fm;h=45a9968dd829c3b9a5b6b88e5eb9068eacd5c9c3;hp=1355b82414f9b215386cc30562eccfb6c66c0f38;hb=c6e200ef183f053470f074d0678256a2d3cb47dd;hpb=e753f61dad8421c4c6b0434e420d731581054c0c diff --git a/bin/engine-di.fm b/bin/engine-di.fm index 1355b82..45a9968 100755 --- a/bin/engine-di.fm +++ b/bin/engine-di.fm @@ -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,16 @@ 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,@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);