From bedf2195ca64805f43eb072f5345d283ef93f07c Mon Sep 17 00:00:00 2001 From: Deluan Date: Mon, 26 Jul 2021 16:50:45 -0400 Subject: [PATCH] Don't send invalid scrobbles when clearing the player's queue --- ui/src/audioplayer/Player.js | 2 +- ui/src/subsonic/index.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/src/audioplayer/Player.js b/ui/src/audioplayer/Player.js index 2e2e4e18f..48a6683d1 100644 --- a/ui/src/audioplayer/Player.js +++ b/ui/src/audioplayer/Player.js @@ -103,7 +103,7 @@ const Player = () => { } if (!scrobbled) { - subsonic.scrobble(info.trackId, true, startTime) + info.trackId && subsonic.scrobble(info.trackId, startTime) setScrobbled(true) } }, diff --git a/ui/src/subsonic/index.js b/ui/src/subsonic/index.js index e8562f55d..241a3ec30 100644 --- a/ui/src/subsonic/index.js +++ b/ui/src/subsonic/index.js @@ -22,7 +22,7 @@ const url = (command, id, options) => { return `/rest/${command}?${params.toString()}` } -const scrobble = (id, submission = false, time) => +const scrobble = (id, time, submission = true) => httpClient( url('scrobble', id, { ...(submission && time && { time }), @@ -30,7 +30,7 @@ const scrobble = (id, submission = false, time) => }) ) -const nowPlaying = (id) => scrobble(id, false) +const nowPlaying = (id) => scrobble(id, null, false) const star = (id) => httpClient(url('star', id))