diff --git a/lib/sites/parser.pm b/lib/sites/parser.pm index 8e72e44469a22a5e9f4a7664d0ef9fdcd482f7e9..ff95bf8719bd993f68ef508d400c021aa8daeb10 100644 --- a/lib/sites/parser.pm +++ b/lib/sites/parser.pm @@ -60,6 +60,9 @@ sub parse { # if we get a new content, we must save it if (%content) { + # we assume it's a new content + my $new = 1; + if ($debug) { $log->debug($content{'url'}); } @@ -75,6 +78,8 @@ sub parse { $content{'author'}, $content{'title'}, $content{'duration'}); }; if ($@) { + # seems to be already present in database + $new = 0; $log->error("Couldn't finish transaction: " . $@); } } @@ -117,7 +122,12 @@ sub parse { $dbh->commit; # message sur irc - $content{'id'} = $id; + if ($new) { + $content{'id'} = '+'.$id; + } + else { + $content{'id'} = $id; + } $content{'tags'} = \@tags; delete $content{'url'}; $irc->yield(privmsg => $chan => utils::print::print(\%content));