Author: sparky
Date: Mon Dec 20 00:00:54 2010
New Revision: 12009

Modified:
   toys/rsget.pl/RSGet/Captcha.pm
   toys/rsget.pl/RSGet/Wait.pm
Log:
- progress bar for wait times and captcha


Modified: toys/rsget.pl/RSGet/Captcha.pm
==============================================================================
--- toys/rsget.pl/RSGet/Captcha.pm      (original)
+++ toys/rsget.pl/RSGet/Captcha.pm      Mon Dec 20 00:00:54 2010
@@ -20,6 +20,8 @@
        },
 );
 
+my $captchatime = 200;
+
 our %needed;
 our %solved;
 
@@ -40,7 +42,7 @@
        $self->{captcha_next} = $next_stage;
        $self->{captcha_data} = \$data;
 
-       $self->{captcha_until} = time + 200;
+       $self->{captcha_until} = time + $captchatime;
        delete $self->{captcha_response};
 
        my $id = 0;
@@ -86,7 +88,8 @@
 
        # add to ask list
        $needed{ $md5 } = [ $self->{content_type}, $self->{captcha_data}, 
$self->{captcha_until} ];
-       $self->linedata( captcha => $md5 );
+       $self->linedata( captcha => $md5, prog => 0 );
+       $self->linecolor( "red" );
 }
 
 sub captcha_result
@@ -192,6 +195,7 @@
                                ( $captcha ? "captcha solved: $captcha, 
delaying " : "solve captcha " )
                                . s2string( $left )
                        );
+                       $obj->linedata( captcha => $md5, prog => 1 - $left / 
$captchatime );
                        next;
                }
                delete $waiting{ $id };

Modified: toys/rsget.pl/RSGet/Wait.pm
==============================================================================
--- toys/rsget.pl/RSGet/Wait.pm (original)
+++ toys/rsget.pl/RSGet/Wait.pm Mon Dec 20 00:00:54 2010
@@ -19,7 +19,7 @@
        my $msg = shift || "???";
        my $reason = shift || "wait";
 
-       $self->linedata( wait => $reason );
+       $self->linedata( prog => 0 );
        my %wait_to_color = (
                restart => "orange",
                multi => "red",
@@ -42,6 +42,7 @@
        $self->{wait_next} = $next_stage;
        $self->{wait_msg} = $msg;
        $self->{wait_until} = $time + $wait;
+       $self->{wait} = $wait;
 
        my $id = 0;
        ++$id while exists $waiting{ $id };
@@ -84,6 +85,7 @@
                        } else {
                                $obj->print( $obj->{wait_msg} . "; waiting " . 
s2string( $left ) );
                        }
+                       $obj->linedata( prog => 1 - $left / $obj->{wait} );
                }
        }
        RSGet::Line::status( 'waiting' => scalar keys %waiting );
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to