From c9b119f0a40b962f0141a434b33b74466242383b Mon Sep 17 00:00:00 2001 From: Deluan Date: Wed, 4 Nov 2020 23:51:48 -0500 Subject: [PATCH] Make scrobble submits compatible with Last.FM specification See https://github.com/deluan/navidrome/issues/18#issuecomment-656977060 --- ui/src/audioplayer/Player.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ui/src/audioplayer/Player.js b/ui/src/audioplayer/Player.js index ad84e2f9..f5612fa3 100644 --- a/ui/src/audioplayer/Player.js +++ b/ui/src/audioplayer/Player.js @@ -140,10 +140,17 @@ const Player = () => { if (info.ended) { document.title = 'Navidrome' } + + // See https://www.last.fm/api/scrobbling#when-is-a-scrobble-a-scrobble const progress = (info.currentTime / info.duration) * 100 - if (isNaN(info.duration) || progress < 90) { + if ( + isNaN(info.duration) || + info.duration < 30 || + (progress < 50 && info.currentTime < 240) + ) { return } + const item = queue.queue.find((item) => item.trackId === info.trackId) if (item && !item.scrobbled) { dispatch(scrobble(info.trackId, true))