diff --git a/lib/sites/parser.pm b/lib/sites/parser.pm index ff97f414683d0eca49e574980894e229e5e99f6c..b4477aefe7d2b83b595c2de9fa4813cb6da4ef31 100644 --- a/lib/sites/parser.pm +++ b/lib/sites/parser.pm @@ -83,12 +83,23 @@ sub parse { } # message sur irc + my $msg = '['.$id.'] '.$content{'title'}; if (defined $content{'author'}) { - $irc->yield(privmsg => $chan => '['.$id.'] '.$content{'title'}.' | '.$content{'author'}) ; - } - else { - $irc->yield(privmsg => $chan => '['.$id.'] '.$content{'title'}) ; + $msg .= ' | '.$content{'author'}; } + if (defined $content{'duration'}) { + my $h = int($content{'duration'} / 3600); + my $m = int(($content{'duration'} % 3600) / 60); + my $s = int(($content{'duration'} % 3600) % 3600); + + $msg .= ' ( '; + $msg .= sprintf("%02d:", $h) if ($h > 0); + $msg .= sprintf("%02d:", $m); + $msg .= sprintf("%02d", $s); + $msg .= ' )'; + } + + $irc->yield(privmsg => $chan => $msg); # insertion du chan my $sth = $dbh->prepare_cached('