We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 032b9656 authored by clint's avatar clint

silently ignore scrobbles that have already been accepted

parent 8a23a1cf
......@@ -111,6 +111,20 @@ function createTrackIfNew($artist, $album, $track, $mbid) {
}
}
function scrobbleExists($username, $artist, $track, $time) {
global $mdb2;
$res = $mdb2->query("SELECT time FROM Scrobbles WHERE username = " . ($username) . " AND artist = " . ($artist) . " AND track = " . ($track) . " AND time = " . ($time));
if(PEAR::isError($res)) {
die("FAILED " . $res->getMessage());
}
if(!$res->numRows()) {
return false;
} else {
return true;
}
}
function NoSpamTracks ($track) {
// This function exists to remove things like '(PREVIEW: buy it at www.magnatune.com)' from track names.
......
......@@ -105,6 +105,7 @@ for($i = 0; $i < count($_POST['a']); $i++) {
}
createTrackIfNew($artist, $album, $track, $mbid);
if(!scrobbleExists($username, $artist, $track, $time)) {
// Scrobble!
$rowvalues .= "("
. $username . ", "
......@@ -116,6 +117,7 @@ for($i = 0; $i < count($_POST['a']); $i++) {
. $source . ","
. $rating . ","
. $length . ")";
}
if(($i+1) == count($_POST['a'])) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment