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

[sites/parser] indicate new insertion

parent a3a0cd84
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -60,6 +60,9 @@ sub parse { ...@@ -60,6 +60,9 @@ sub parse {
# if we get a new content, we must save it # if we get a new content, we must save it
if (%content) { if (%content) {
# we assume it's a new content
my $new = 1;
if ($debug) { if ($debug) {
$log->debug($content{'url'}); $log->debug($content{'url'});
} }
...@@ -75,6 +78,8 @@ sub parse { ...@@ -75,6 +78,8 @@ sub parse {
$content{'author'}, $content{'title'}, $content{'duration'}); $content{'author'}, $content{'title'}, $content{'duration'});
}; };
if ($@) { if ($@) {
# seems to be already present in database
$new = 0;
$log->error("Couldn't finish transaction: " . $@); $log->error("Couldn't finish transaction: " . $@);
} }
} }
...@@ -117,7 +122,12 @@ sub parse { ...@@ -117,7 +122,12 @@ sub parse {
$dbh->commit; $dbh->commit;
# message sur irc # message sur irc
if ($new) {
$content{'id'} = '+'.$id;
}
else {
$content{'id'} = $id; $content{'id'} = $id;
}
$content{'tags'} = \@tags; $content{'tags'} = \@tags;
delete $content{'url'}; delete $content{'url'};
$irc->yield(privmsg => $chan => utils::print::print(\%content)); $irc->yield(privmsg => $chan => utils::print::print(\%content));
......
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