Author: sparky
Date: Thu Oct  1 19:47:13 2009
New Revision: 10643

Added:
   toys/rsget.pl/RSGet/Main.pm
Modified:
   toys/rsget.pl/RSGet/AutoUpdate.pm
   toys/rsget.pl/RSGet/Curl.pm
   toys/rsget.pl/RSGet/FileList.pm
   toys/rsget.pl/RSGet/Get.pm
   toys/rsget.pl/RSGet/Line.pm
   toys/rsget.pl/RSGet/Processor.pm
   toys/rsget.pl/RSGet/Tools.pm
   toys/rsget.pl/rsget.pl
Log:
- moved most of the code from rsget.pl to RSGet::Main
- some other changes


Modified: toys/rsget.pl/RSGet/AutoUpdate.pm
==============================================================================
--- toys/rsget.pl/RSGet/AutoUpdate.pm   (original)
+++ toys/rsget.pl/RSGet/AutoUpdate.pm   Thu Oct  1 19:47:13 2009
@@ -7,6 +7,15 @@
 
 set_rev qq$Id$;
 
+def_settings(
+       use_svn => [ "Set to 'update' to automatically update rsget.pl 
components from SVN. " .
+               "Set to 'yes' to use downloaded components without updating 
first.",
+               "no", qr{no|yes|update} ],
+       svn_uri => [ "SVN path to rsget.pl source code.",
+               'http://svn.pld-linux.org/svn/toys/rsget.pl',
+               qr{(svn|http)://\.{4,}} ],
+);
+
 sub update
 {
        unless ( require_prog( "svn" ) ) {
@@ -14,13 +23,16 @@
                return 0;
        }
        my $start_dir = getcwd();
-       chdir $main::configdir or die "Can't chdir to '$main::configdir'\n";
+       my $svn_dir = $main::local_path;
+       mkdir $svn_dir unless -d $svn_dir;
+       chdir $svn_dir or die "Can't chdir to '$svn_dir'\n";
 
        warn "Updating from SVN\n";
+       my $svn_uri = setting("svn_uri");
        my $updated = 0;
        foreach my $dir ( qw(data RSGet Get Link) ) {
                my $last;
-               open SVN, "-|", "svn", "co", "$settings{svn_uri}/$dir";
+               open SVN, "-|", "svn", "co", "$svn_uri/$dir";
                while ( <SVN> ) {
                        chomp;
                        $updated++ if /^.{4}\s+$dir/;

Modified: toys/rsget.pl/RSGet/Curl.pm
==============================================================================
--- toys/rsget.pl/RSGet/Curl.pm (original)
+++ toys/rsget.pl/RSGet/Curl.pm Thu Oct  1 19:47:13 2009
@@ -12,6 +12,17 @@
 use Fcntl qw(SEEK_SET);
 set_rev qq$Id$;
 
+def_settings(
+       backup => [ "Make backups if downloaded file exists.",
+       "copy,move", qr/copy,move|copy|move|no/ ],
+       backup_suf => [ "Rename backup files with specified suffix. " .
+               "If none defined file extension won't be changed",
+               undef, qr/.+/ ],
+       outdir => [ "Output directory; where finished files are moved.", '.', 
undef ],
+       workdir => [ "Work directory; where unfinished files are stored.", '.', 
undef ],
+);
+
+
 my $curl_multi = new WWW::Curl::Multi;
 
 my $curl_headers = [
@@ -90,7 +101,7 @@
                # if file exists try to continue
                my $fn = $get_obj->{_opts}->{fname};
                if ( $fn ) {
-                       my $fp = filepath( $settings{workdir}, 
$get_obj->{_opts}->{dir}, $fn );
+                       my $fp = filepath( setting("workdir"), 
$get_obj->{_opts}->{dir}, $fn );
                        if ( -r $fp ) {
                                my $got = (stat(_))[7];
                                #p "File '$fn' already exists, trying to 
continue at $got";
@@ -119,10 +130,10 @@
 {
        my $fn = shift;
        my $type = shift;
-       return undef unless $settings{backup} =~ /$type/;
+       return undef unless setting("backup") =~ /$type/;
        return undef unless -r $fn;
 
-       if ( my $s = $settings{backup_suf} ) {
+       if ( my $s = setting("backup_suf") ) {
                my $i = 1;
                ++$i while -r $fn . $s . $i;
                return $fn . $s . $i;
@@ -218,7 +229,7 @@
 
        {
                my $fn = $supercurl->{filepath} =
-                       filepath( $settings{workdir}, $get_obj->{_opts}->{dir}, 
$supercurl->{fname} );
+                       filepath( setting("workdir"), $get_obj->{_opts}->{dir}, 
$supercurl->{fname} );
                my $old = file_backup( $fn, "move" );
                if ( $old ) {
                        rename $fn, $old;
@@ -320,7 +331,7 @@
        my $func = $get_obj->{after_curl};
        if ( $supercurl->{file} ) {
                rename $supercurl->{filepath},
-                       filepath( $settings{outdir}, $get_obj->{_opts}->{dir}, 
$supercurl->{fname} );
+                       filepath( setting("outdir"), $get_obj->{_opts}->{dir}, 
$supercurl->{fname} );
                $get_obj->{dlinfo} = sprintf 'DONE %s %s / %s',
                        $supercurl->{fname},
                        bignum( $supercurl->{size_got} ),

Modified: toys/rsget.pl/RSGet/FileList.pm
==============================================================================
--- toys/rsget.pl/RSGet/FileList.pm     (original)
+++ toys/rsget.pl/RSGet/FileList.pm     Thu Oct  1 19:47:13 2009
@@ -6,6 +6,11 @@
 use RSGet::Tools;
 set_rev qq$Id$;
 
+def_settings(
+       list_lock => [ "If lock file exists, list file won't be updated.", 
'.${file}.swp', qr/.+/ ],
+       list_file => [ "Use specified file as URI list.", undef, qr/.+/ ],
+);
+
 my $file;
 my $file_swp;
 
@@ -23,10 +28,12 @@
 
 sub set_file
 {
-       $file = shift;
+       $file = setting( "list_file" );
        unless ( defined $file ) {
                $file = 'get.list';
-               unless ( -r $file ) {
+               if ( -r $file ) {
+                       p "Using '$file' file list\n";
+               } else {
                        p "Creating empty file list '$file'";
                        open F_OUT, '>', $file;
                        print F_OUT "# empty list\n";
@@ -36,8 +43,7 @@
                p "Using '$file' file list\n";
        }
        die "Can't read '$file'\n" unless -r $file;
-       my $make_swp = $settings{list_lock};
-       $file_swp = eval "\"$make_swp\"";
+       ( $file_swp = setting( "list_lock" ) ) =~ s/\${file}/$file/g;
        p "Using '$file_swp' as file lock\n";
 }
 

Modified: toys/rsget.pl/RSGet/Get.pm
==============================================================================
--- toys/rsget.pl/RSGet/Get.pm  (original)
+++ toys/rsget.pl/RSGet/Get.pm  Thu Oct  1 19:47:13 2009
@@ -7,6 +7,9 @@
 use RSGet::Wait;
 use URI;
 set_rev qq$Id$;
+def_settings(
+       errorlog => [ "Save errors", 0, qr/\d/ ],
+);
 
 BEGIN {
        our @ISA;
@@ -48,7 +51,7 @@
        bless $self, $pkg;
        $self->bestinfo();
 
-       if ( $settings{logging} > 1 or $cmd eq "get" ) {
+       if ( setting("verbose") > 1 or $cmd eq "get" ) {
                my $outifstr = $outif ? "[$outif]" :  "";
 
                hadd $self,
@@ -222,7 +225,7 @@
 {
        my $self = shift;
        my $msg = shift;
-       if ( $self->{body} and $settings{errorlog} ) {
+       if ( $self->{body} and setting("errorlog") ) {
                my $n = 0;
                my $name;
                do {
@@ -292,7 +295,7 @@
 
        return 0 unless $self->{_cmd} eq "check";
        p "info( $self->{_uri} ): $self->{bestname} ($self->{bestsize})\n"
-               if $settings{logging} > 0;
+               if setting("verbose") > 0;
        RSGet::Dispatch::finished( $self );
        return 1;
 }

Modified: toys/rsget.pl/RSGet/Line.pm
==============================================================================
--- toys/rsget.pl/RSGet/Line.pm (original)
+++ toys/rsget.pl/RSGet/Line.pm Thu Oct  1 19:47:13 2009
@@ -6,8 +6,6 @@
 use Term::Size;
 set_rev qq$Id$;
 
-$| = 1;
-
 our %active;
 my %dead;
 our @dead;
@@ -31,7 +29,6 @@
                push @newdead, $date;
        }
 
-
        foreach my $key ( sort { $a <=> $b } keys %dead ) {
                my $text = $dead{$key};
                $text = $time . $text if $text =~ /\S/;
@@ -175,32 +172,37 @@
        hadd( \%status, @_ );
 }
 
-$SIG{INT} = sub {
-       print_all_lines();
-       print "\nTERMINATED\n";
-       exit 0;
-};
+sub init
+{
+       $| = 1;
 
-$SIG{WINCH} = sub {
-       print "\033[2J\033[1;1H\n";
-       my ( $columns, $rows ) = Term::Size::chars;
-       my $start = $#dead - $rows;
-       $start = 0 if $start < 0;
-       print join( "\n", @dead[($start..$#dead)] ), "\n";
-       update();
-};
-
-$SIG{__WARN__} = sub {
-       new RSGet::Line( "WARNING: ", shift );
-       update();
-};
-
-local $SIG{__DIE__} = sub {
-       print_all_lines();
-       print "\n";
-       print "DIED: ", shift, "\n\n";
-       exit 1;
-};
+       $SIG{INT} = sub {
+               print_all_lines();
+               print "\nTERMINATED\n";
+               exit 0;
+       };
+
+       $SIG{WINCH} = sub {
+               print "\033[2J\033[1;1H\n";
+               my ( $columns, $rows ) = Term::Size::chars;
+               my $start = $#dead - $rows;
+               $start = 0 if $start < 0;
+               print join( "\n", @dead[($start..$#dead)] ), "\n";
+               update();
+       };
+
+       $SIG{__WARN__} = sub {
+               new RSGet::Line( "WARNING: ", shift );
+               update();
+       };
+
+       local $SIG{__DIE__} = sub {
+               print_all_lines();
+               print "\n";
+               print "DIED: ", shift, "\n\n";
+               exit 1;
+       };
+}
 
 1;
 

Added: toys/rsget.pl/RSGet/Main.pm
==============================================================================
--- (empty file)
+++ toys/rsget.pl/RSGet/Main.pm Thu Oct  1 19:47:13 2009
@@ -0,0 +1,188 @@
+package RSGet::Main;
+#
+# 2009 (c) Przemysław Iskra <[email protected]>
+# Use/modify/distribute under GPL v2 or newer.
+#
+use strict;
+use warnings;
+use RSGet::AutoUpdate;
+use RSGet::Captcha;
+use RSGet::Curl;
+use RSGet::Dispatch;
+use RSGet::FileList;
+use RSGet::Get;
+use RSGet::Line;
+use RSGet::ListManager;
+use RSGet::Processor;
+use RSGet::Tools;
+use RSGet::Wait;
+use Time::HiRes;
+
+set_rev qq$Id$;
+
+def_settings(
+       interfaces => [ "Specify output interfaces or IP addresses", undef, 
qr/\d+/ ],
+       http_port => [ "Start HTTP server on specified port.", 0, qr/\d+/ ],
+       verbose => [ "Verbosity level", 0, qr/\d+/ ],
+);
+
+my $http = undef;
+sub init
+{
+       my $help = shift;
+       my $main_rev = shift;
+       my $argv = shift;
+       my $ifs = shift;
+       set_rev $main_rev;
+
+       print_help() if $help;
+       check_settings();
+
+       $SIG{CHLD} = "IGNORE";
+       maybe_update( $argv );
+       RSGet::Line::init();
+       print_settings() if setting( "verbose" ) >= 1;
+       RSGet::FileList::set_file();
+       maybe_start_http();
+       set_interfaces( $ifs );
+
+       new RSGet::Line();
+
+       find_getters();
+
+       new RSGet::Line();
+       new RSGet::Line( "rsget.pl started successfully" );
+       new RSGet::Line();
+       RSGet::Line::update();
+
+       loop();
+}
+
+sub print_help
+{
+       require Term::Size;
+       my ( $columns, $rows ) = Term::Size::chars;
+       warn "No help yet\n";
+
+       exit 0;
+}
+
+sub maybe_update
+{
+       my $argv = shift;
+       if ( setting( "use_svn" ) eq "update" ) {
+               if ( RSGet::AutoUpdate::update() ) {
+                       warn "Update successful, restarting\n";
+                       exec $0, @$argv, "--use_svn", "yes";
+               }
+       }
+}
+
+sub check_settings
+{
+       warn "Unable to check settings\n";
+}
+
+sub print_settings
+{
+       p "Settings:";
+       foreach my $s ( sort keys %main::settings ) {
+               p "  $s => " . setting( $s );
+       }
+}
+
+sub maybe_start_http
+{
+       my $port = setting( "http_port" );
+       return unless $port;
+
+       require RSGet::HTTPServer;
+       $http = new RSGet::HTTPServer( setting("http_port") );
+       if ( $http ) {
+               p "HTTP server started on port $port";
+       } else {
+               warn "HTTP server failed (port $port)\n";
+       }
+}
+
+sub set_interfaces
+{
+       my $ifs = shift;
+       my $if = setting( "interfaces" );
+       RSGet::Dispatch::add_interface( $if ) if $if;
+       foreach my $if ( @$ifs ) {
+               RSGet::Dispatch::add_interface( $if );
+       }
+}
+
+sub find_getters
+{
+       my @paths = ( $main::install_path );
+       if ( setting( "use_svn" ) eq "yes" ) {
+               unshift @paths, $main::local_path;
+       }
+       foreach my $path ( @paths ) {
+               foreach my $type ( qw(Get Link) ) {
+                       my $dir = "$path/$type";
+                       next unless -d $dir;
+                       foreach ( sort glob "$path/$type/*" ) {
+                               add_getter( $type, $_ );
+                       }
+               }
+       }
+}
+
+sub add_getter
+{
+       my $type = shift;
+       local $_ = shift;
+       return if /~$/;
+       return if m{/\.[^/]*$};
+       ( my $file = $_ ) =~ s#.*/##;
+       return if exists $getters{ $type . "::" . $file };
+       my ( $pkg, $getter ) = RSGet::Processor::read_file( $type, $_ );
+       my $msg = "${type}/$file: failed";
+       if ( $pkg and $getter ) {
+               $getters{ $pkg } = $getter;
+               $msg = "$pkg: added\n";
+               new RSGet::Line( "INIT: ", $msg );
+       } else {
+               warn "$msg\n";
+       }
+}
+
+sub loop
+{
+       # main loop
+       my $lasttime = 0;
+       for (;;) {
+               if ( RSGet::Curl::need_run() ) {
+                       RSGet::Curl::maybe_abort();
+                       foreach ( 0..4 ) {
+                               RSGet::Curl::perform();
+                               Time::HiRes::sleep(0.050);
+                       }
+               } else {
+                       Time::HiRes::sleep(0.250);
+               }
+               RSGet::Curl::update_status();
+               RSGet::Line::update();
+               $http->perform() if $http;
+
+               my $time = time;
+               next if $time == $lasttime;
+               $lasttime = $time;
+       
+               RSGet::Wait::wait_update();
+               RSGet::Captcha::captcha_update();
+
+               my $getlist = RSGet::FileList::readlist();
+               if ( $getlist ) {
+                       my $allchk = RSGet::Dispatch::process( $getlist );
+                       RSGet::ListManager::autoadd( $getlist );
+               }
+       }
+}
+
+1;
+# vim:ts=4:sw=4

Modified: toys/rsget.pl/RSGet/Processor.pm
==============================================================================
--- toys/rsget.pl/RSGet/Processor.pm    (original)
+++ toys/rsget.pl/RSGet/Processor.pm    Thu Oct  1 19:47:13 2009
@@ -5,7 +5,7 @@
 use RSGet::Tools;
 set_rev qq$Id$;
 
-my $options = "name|short|slots|cookie|status";
+my $options = "name|short|slots|cookie|status|min_ver";
 my $parts = "pre|start|perl";
 
 my $processed = "";
@@ -233,7 +233,7 @@
 
        if ( $@ ) {
                p "Error(s): $...@\n";
-               return undef unless $settings{logging} > 0;
+               return undef unless setting("verbose") > 0;
                my $err = $@;
                return undef unless $err =~ /line \d+/;
                my @p = split /\n/, $processed;

Modified: toys/rsget.pl/RSGet/Tools.pm
==============================================================================
--- toys/rsget.pl/RSGet/Tools.pm        (original)
+++ toys/rsget.pl/RSGet/Tools.pm        Thu Oct  1 19:47:13 2009
@@ -7,10 +7,10 @@
 require Exporter;
 @ISA = qw(Exporter);
 @EXPORT = qw(set_rev s2string bignum de_ml hadd hprint p isotime require_prog
-       data_file dump_to_file randomize %getters %settings);
+       def_settings setting
+       data_file dump_to_file randomize %getters);
 @EXPORT_OK = qw();
 
-our %settings;
 our %getters;
 our %revisions;
 
@@ -114,13 +114,32 @@
 sub data_file
 {
        my $file = shift;
-       my $f = "$main::configdir/data/$file";
+       my $f = "$main::local_path/data/$file";
        return $f if -r $f;
-       $f = "$main::data_path/data/$file";
+       $f = "$main::install_path/data/$file";
        return $f if -r $f;
        return undef;
 }
 
+sub def_settings
+{
+       my %s = @_;
+       foreach my $k ( keys %s ) {
+               my $v = $s{ $k };
+               die "Incorrect setting '$k' declaration\n"
+                       if ref $v ne "ARRAY" or scalar @$v != 3;
+               $main::def_settings{ $k } = $v;
+       }
+}
+
+sub setting
+{
+       my $name = shift;
+       die "Setting '$name' is not defined\n" unless exists 
$main::def_settings{ $name };
+       return $main::settings{ $name }->[0] if exists $main::settings{ $name };
+       return $main::def_settings{ $name }->[1];
+}
+
 sub dump_to_file
 {
        my $data = shift;

Modified: toys/rsget.pl/rsget.pl
==============================================================================
--- toys/rsget.pl/rsget.pl      (original)
+++ toys/rsget.pl/rsget.pl      Thu Oct  1 19:47:13 2009
@@ -5,71 +5,72 @@
 #
 use strict;
 use warnings;
+my $rev = qq$Id$;
 
-our $data_path;
-our $configdir;
-BEGIN {
-       $data_path = $ENV{PWD};
-       unshift @INC, $data_path;
-
-       my $cd = "$ENV{HOME}/.rsget.pl";
-       if ( -r $cd and -d $cd ) {
-               $configdir = $cd;
-               unshift @INC, $configdir;
-       } else {
-               $configdir = $data_path;
-       }
-}
+our $install_path = $ENV{PWD};
+our $local_path = $install_path;
 
-use Time::HiRes;
-use RSGet::Line;
-use RSGet::Tools;
-use RSGet::AutoUpdate;
-use RSGet::Processor;
-use RSGet::Curl;
-use RSGet::FileList;
-use RSGet::Get;
-use RSGet::Wait;
-use RSGet::Captcha;
-use RSGet::Dispatch;
-use RSGet::ListManager;
-$SIG{CHLD} = "IGNORE";
-
-set_rev qq$Id$;
-
-%settings = (
-       auto_update => undef,
-       svn_uri => 'http://svn.pld-linux.org/svn/toys/rsget.pl',
-       backup => "copy,move",
-       backup_suf => undef,
-       logging => 0,
-       list_lock => '.${file}.swp', # vim-like swap file
-       http_port => undef,
-       list_file => undef,
-       errorlog => 0,
-       outdir => '.',
-       workdir => '.',
+our %def_settings;
+our %settings = (
+       use_svn => [ "no", undef ]
 );
 
+unshift @INC, $install_path;
+
+my $cdir = "$ENV{HOME}/.rsget.pl";
+read_config( "$cdir/config" );
+
 my @save_ARGV = @ARGV;
+my $help;
+my @ifs;
+parse_args();
+
+if ( $settings{use_svn}->[0] =~ /^(yes|update)$/ and -d "$cdir/RSGet") {
+       $local_path = $cdir;
+       unshift @INC, $local_path;
+
+       eval {
+               require RSGet::Main;
+       };
+       if ( $@ ) {
+               shift @INC;
+               warn "Cannot use components from SVN: $...@\n";
+               set( "use_svn", "no", "disabled because of errors" )
+                       if $settings{use_svn}->[0] eq "yes";
+       }
+}
+
+eval {
+       require RSGet::Main;
+};
+if ( $@ ) {
+       die "Cannot start rsget.pl: $...@\n";
+}
+
+RSGet::Main::init( $help, $rev, \...@save_argv, \...@ifs );
+die "init failed";
 
 sub set
 {
-       my ( $key, $val ) = @_;
-       if ( exists $settings{ $key } ) {
-               $settings{ $key } = $val;
-       } else {
-               warn "Option '$key' does not exist\n";
-       }
+       my $name = shift;
+       my $value = shift;
+       my $where_defined = shift;
+       $name =~ tr/-/_/;
+       $settings{ $name } = [ $value, $where_defined ];
 }
 
-if ( -r "$configdir/config" ) {
-       open F_IN, "<", "$configdir/config";
+sub read_config
+{
+       my $cfg = shift;
+       return unless -r $cfg;
+       my $line = 0;
+       open F_IN, "<", $cfg;
        while ( <F_IN> ) {
+               $line++;
                next if /^\s*(?:#.*)?$/;
                chomp;
                if ( s/^\s*([a-z_]+)\s*=\s*// ) {
-                       set( $1, $_ );
+                       set( $1, $_, "config file, line $line" );
                        next;
                }
                warn "Incorrect config line: $_\n";
@@ -77,107 +78,25 @@
        close F_IN;
 }
 
-# read options
-while ( my $arg = shift @ARGV ) {
-       if ( $arg eq '-h' ) {
-               die "No help here, sorrt. For real help read documentation.\n";
-       } elsif ( $arg eq '-i' ) {
-               my $ifs = shift @ARGV || die "argument missing";
-               RSGet::Dispatch::add_interface( $ifs );
-       } elsif ( $arg eq '-p' ) {
-               set( "http_port", shift @ARGV || die "port missing" );
-       } elsif ( $arg =~ s/^--(.*?)=// ) {
-               set( $1, $arg );
-       } elsif ( $arg =~ s/^--(.*)// ) {
-               my $key = $1;
-               my $var = shift @ARGV;
-               die "argument missing" unless defined $var;
-               set( $key, $var );
-       } else {
-               set( "list_file", $arg );
-       }
-}
-
-if ( $settings{auto_update} ) {
-       if ( RSGet::AutoUpdate::update() ) {
-               warn "Update successful, restarting\n";
-               exec $0, @save_ARGV, "--auto_update", 0;
-       }
-}
-if ( keys %settings ) {
-       p "Settings:";
-       hprint \%settings;
-}
-
-RSGet::FileList::set_file( $settings{list_file} );
-
-my $http = undef;
-if ( $settings{http_port} ) {
-       require RSGet::HTTPServer;
-       $http = new RSGet::HTTPServer( $settings{http_port} );
-       p "HTTP server " . ( $http ? "started on port $settings{http_port}" : 
"failed" ) ;
-}
-
-if ( $settings{interfaces} ) {
-       RSGet::Dispatch::add_interface( $settings{interfaces} );
-}
-
-new RSGet::Line();
-
-# add getters
-foreach my $path ( ( $configdir, $data_path ) ) {
-  foreach my $type ( qw(Get Link) ) {
-       foreach ( sort glob "$path/$type/*" ) {
-               next if /~$/;
-               next if m{/\.[^/]*$};
-               ( my $file = $_ ) =~ s#.*/##;
-               next if exists $getters{ $type . "::" . $file };
-               my ( $pkg, $getter ) = RSGet::Processor::read_file( $type, $_ );
-               my $msg = "${type}/$file: failed";
-               if ( $pkg and $getter ) {
-                       $getters{ $pkg } = $getter;
-                       $msg = "$pkg: added\n";
-                       new RSGet::Line( "INIT: ", $msg );
+sub parse_args
+{
+       my $argnum = 0;
+       while ( my $arg = shift @ARGV ) {
+               $argnum++;
+               if ( $arg =~ /^-?-h(elp)?$/ ) {
+                       $help = 1;
+               } elsif ( $arg =~ s/^--(.*?)=// ) {
+                       set( $1, $arg, "command line, argument $argnum" );
+               } elsif ( $arg =~ s/^--(.*)// ) {
+                       my $key = $1;
+                       my $var = shift @ARGV;
+                       die "value missing for '$key'" unless defined $var;
+                       my $a = $argnum++;
+                       set( $key, $var, "command line, argument $a-$argnum" );
                } else {
-                       warn "$msg\n";
+                       set( "list_file", $arg, "command line, argument 
$argnum" );
                }
        }
-  }
 }
-new RSGet::Line();
-new RSGet::Line( "rsget.pl started successfully" );
-new RSGet::Line();
-RSGet::Line::update();
-
-# main loop
-my $lasttime = 0;
-for (;;) {
-       if ( RSGet::Curl::need_run() ) {
-               RSGet::Curl::maybe_abort();
-               foreach ( 0..4 ) {
-                       RSGet::Curl::perform();
-                       Time::HiRes::sleep(0.050);
-               }
-       } else {
-               Time::HiRes::sleep(0.250);
-       }
-       RSGet::Curl::update_status();
-       RSGet::Line::update();
-       $http->perform() if $http;
-
-       my $time = time;
-       next if $time == $lasttime;
-       $lasttime = $time;
-
-       RSGet::Wait::wait_update();
-       RSGet::Captcha::captcha_update();
-
-       my $getlist = RSGet::FileList::readlist();
-       if ( $getlist ) {
-               my $allchk = RSGet::Dispatch::process( $getlist );
-               RSGet::ListManager::autoadd( $getlist );
-       }
-}
-
 
 # vim:ts=4:sw=4
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to