diff --git a/lib/sites/parser.pm b/lib/sites/parser.pm index e29343abb0d25048717fd489cc7892446d8894a4..bd481dd01c02d385bb1ee1421a577bf84273a936 100644 --- a/lib/sites/parser.pm +++ b/lib/sites/parser.pm @@ -74,7 +74,8 @@ sub parse { eval { my $sth = $dbh->prepare(' INSERT INTO playbot (type, url, sender, title, duration) - VALUES (?,?,?,?,?)'); + VALUES (?,?,?,?,?) + '); $log->error("Couldn't prepare querie; aborting") unless (defined $sth); $sth->execute($content{'site'}, $content{'url'}, @@ -83,7 +84,22 @@ sub parse { if ($@) { # seems to be already present in database $new = 0; - $log->error("Couldn't finish transaction: " . $@); + + my $sth = $dbh->prepare(' + UPDATE playbot playbot SET + sender = ?, + title = ?, + duration = ? + WHERE url = ? + '); + $log->error("Couldn't prepare querie; aborting") unless (defined $sth); + + $sth->execute( + $content{'author'}, + $content{'title'}, + $content{'duration'}, + $content{'url'}, + ); } }