our ($fexhome,$idf,$tmpdir,$windoof,$useragent);
our ($xv,%autoview);
our $bs = 2**16; # blocksize for tcp-reading and writing file
-our $version = 20160104;
+our $version = 20160328;
our $CTYPE = 'ISO-8859-1';
our $fexsend = $ENV{FEXSEND} || 'fexsend';
our $DEBUG = $ENV{DEBUG};
+our $_0 = $0;
my %SSL = (SSL_version => 'TLSv1');
my $sigpipe;
${'opt_+'} = 0;
$opt_s = $opt_k = $opt_i = $opt_P = '';
$_ = "$fexhome/config.pl"; require if -f;
-getopts('hvVHlLdkzoaXf+m:s:i:K:P:') or die $usage;
+getopts('hvVHlLdkzoaXVf+m:s:i:K:P:') or die $usage;
$opt_k = '?KEEP' if $opt_k;
if ($opt_m =~ /(\d+)/) {
$opt_m = 0
}
-print "Version: $version\n" if $opt_V;
+if ($opt_V) {
+ print "Version: $version\n";
+ unless (@ARGV) {
+ print "Upgrade fexget? ";
+ $_ = <STDIN>||'';
+ if (/^y/i) {
+ my $new = `wget -nv -O- http://fex.belwue.de/download/fexget`;
+ if ($new !~ /upgrade fexget/) {
+ die "$0: bad update\n";
+ }
+ system qw'cp -a',$_0,$_0.'_old';
+ exit $? if $?;
+ open $_0,'>',$_0 or die "$0: cannot write $_0. - $!\n";
+ print {$_0} $new;
+ close $_0;
+ exec $_0,qw'-V .';
+ }
+ }
+ exit if "@ARGV" eq '.';
+}
+
die $usage if $opt_h;
if ($opt_H) {
print $hints;
my @rcamel = (
'\e[A
-(_*) _ _
- \\\\/ \\/ \\
+ (_*p _ _
+ \\\\/ \/ \\
\ __ )=*
//\\\\//\\\\
',
-'\e[A \\\\/\\\\/
-',
-'\e[A //\\\\//\\\\
-');
+"\e[A \\\\/\\\\/ \n",
+"\e[A //\\\\//\\\\\n"
+);
# get fexlog
if ($opt_z) {
sub download {
my ($server,$port,$fop,$nocheck) = @_;
- my ($file,$download,$ssl,$pipe,$filesize,$checkstorage);
+ my ($file,$download,$ssl,$pipe,$filesize,$checkstorage,$dkey);
my (@hh,@r);
my ($t0,$t1,$t2,$tt,$tm,$ts,$kBs,$b,$bt,$tb,$B,$buf);
my $length = 0;
$seek = -s $download || 0;
}
+ $fop =~ m:/fop/(\w+)/: and $dkey=$1 or $dkey='';
+
push @hh,"GET $proxy_prefix$fop$opt_k HTTP/1.1",
"User-Agent: $useragent",
+ "Cookie: dkey=$dkey",
"Connection: close";
push @hh,"Range: bytes=$seek-" if $seek;