git://git.jankratochvil.net
/
nethome.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
+sync
[nethome.git]
/
bin
/
engine-di.fm
diff --git
a/bin/engine-di.fm
b/bin/engine-di.fm
index
1355b82
..
45a9968
100755
(executable)
--- 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);
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},
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";
$pathslashed=~s{^.*/}{};
$pathslashed=~tr{-}{/};
my $streamlisturl="http://$pathslashed";
-for (;;) {
-
+my $tried;
+do {
sub streamlist_get($)
{
my($streamlist)=@_;
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+))?})) {
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(
$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";
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);
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 $?;
}
exit 0 if $?;
}
-}
+}
while ($tried);