SVN: toys/rsget.pl/RSGet: Curl.pm Get.pm Wait.pm

sparky sparky at pld-linux.org
Sun Dec 19 20:55:28 CET 2010


Author: sparky
Date: Sun Dec 19 20:55:28 2010
New Revision: 12003

Modified:
   toys/rsget.pl/RSGet/Curl.pm
   toys/rsget.pl/RSGet/Get.pm
   toys/rsget.pl/RSGet/Wait.pm
Log:
- more colors


Modified: toys/rsget.pl/RSGet/Curl.pm
==============================================================================
--- toys/rsget.pl/RSGet/Curl.pm	(original)
+++ toys/rsget.pl/RSGet/Curl.pm	Sun Dec 19 20:55:28 2010
@@ -504,12 +504,15 @@
 			my $if = $get_obj->{_outif};
 			RSGet::Dispatch::remove_interface( $if, "Interface $if is dead" );
 			$get_obj->{_abort} = "Interface $if is dead";
+			$get_obj->linecolor( "red" );
 		} elsif ( $error =~ /transfer closed with (\d+) bytes remaining to read/ ) {
 			RSGet::Dispatch::mark_used( $get_obj );
 			$get_obj->{_abort} = "PARTIAL " . donemsg( $supercurl );
+			$get_obj->linecolor( "blue" );
 		} elsif ( $err eq "aborted" ) {
 
 		} else {
+			$get_obj->linecolor( "red" );
 			$get_obj->log( "ERROR($err): $error" );
 		}
 		$get_obj->problem();

Modified: toys/rsget.pl/RSGet/Get.pm
==============================================================================
--- toys/rsget.pl/RSGet/Get.pm	(original)
+++ toys/rsget.pl/RSGet/Get.pm	Sun Dec 19 20:55:28 2010
@@ -86,6 +86,7 @@
 			_line => new RSGet::Line( "[$getter->{short}]$outifstr ", undef, undef, "green" );
 		$self->print( "start" );
 		$self->linedata();
+		$self->linecolor();
 	}
 	if ( $cmd eq "get" ) {
 		local $SIG{__DIE__};
@@ -174,6 +175,16 @@
 	$line->linedata( \%data );
 }
 
+sub linecolor
+{
+	my $self = shift;
+	my $line = $self->{_line};
+	my $color = shift;
+	return unless $line;
+
+	$line->color( $color );
+}
+
 sub start
 {
 	my $self = shift;
@@ -227,6 +238,7 @@
 	$uri = URI->new( $uri )->abs( $self->{_referer} )->as_string
 		if $self->{_referer};
 
+	$self->linecolor( "green" );
 	RSGet::Curl::new( $uri, $self, @_ );
 }
 

Modified: toys/rsget.pl/RSGet/Wait.pm
==============================================================================
--- toys/rsget.pl/RSGet/Wait.pm	(original)
+++ toys/rsget.pl/RSGet/Wait.pm	Sun Dec 19 20:55:28 2010
@@ -20,6 +20,14 @@
 	my $reason = shift || "wait";
 
 	$self->linedata( wait => $reason );
+	my %wait_to_color = (
+		restart => "orange",
+		multi => "red",
+		problem => "red",
+		wait => "blue",
+		delay => "cyan",
+	);
+	$self->linecolor( $wait_to_color{ $reason } );
 
 	my $time = time;
 	delete $self->{wait_until_should};
@@ -48,6 +56,7 @@
 	$_ = undef;
 
 	$self->linedata();
+	$self->linecolor();
 	my $func = $self->{wait_next};
 	&$func( $self );
 }


More information about the pld-cvs-commit mailing list