Skip to content
Extraits de code Groupes Projets
Valider e7d6d21b rédigé par Alexandre Morignot's avatar Alexandre Morignot
Parcourir les fichiers

♪ You will see colors ! ♫

parent 59b073c5
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -2,6 +2,8 @@ package utils::print; ...@@ -2,6 +2,8 @@ package utils::print;
use strict; use strict;
use IRC::Utils qw(YELLOW ORANGE GREEN NORMAL LIGHT_BLUE GREY);
# Used to print a content. # Used to print a content.
# The public subroutine is print($content). # The public subroutine is print($content).
# arg : # arg :
...@@ -18,7 +20,7 @@ use strict; ...@@ -18,7 +20,7 @@ use strict;
sub print { sub print {
my ($content) = @_; my ($content) = @_;
my $msg = '['.$content->{'id'}.'] '.$content->{'title'}; my $msg = YELLOW.'['.$content->{'id'}.'] '.GREEN.$content->{'title'};
if (defined $content->{'author'}) { if (defined $content->{'author'}) {
$msg .= ' | '.$content->{'author'}; $msg .= ' | '.$content->{'author'};
...@@ -29,19 +31,21 @@ sub print { ...@@ -29,19 +31,21 @@ sub print {
my $m = int(($content->{'duration'} % 3600) / 60); my $m = int(($content->{'duration'} % 3600) / 60);
my $s = int(($content->{'duration'} % 3600) % 60); my $s = int(($content->{'duration'} % 3600) % 60);
$msg .= ' ('; $msg .= LIGHT_BLUE.' (';
$msg .= sprintf("%02d:", $h) if ($h > 0); $msg .= sprintf("%02d:", $h) if ($h > 0);
$msg .= sprintf("%02d:", $m); $msg .= sprintf("%02d:", $m);
$msg .= sprintf("%02d", $s); $msg .= sprintf("%02d", $s);
$msg .= ')'; $msg .= ')'.NORMAL;
} }
$msg .= ' => '.$content->{'url'} if (defined $content->{'url'}); $msg .= ' => '.$content->{'url'}.ORANGE if (defined $content->{'url'});
if (defined $content->{'tags'}) { if (defined $content->{'tags'}) {
$msg .= ' '.$_ foreach (@{$content->{'tags'}}); $msg .= ' '.$_ foreach (@{$content->{'tags'}});
} }
$msg .= GREY;
return $msg; return $msg;
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter