Make scrobble submits compatible with Last.FM specification

See https://github.com/deluan/navidrome/issues/18#issuecomment-656977060
This commit is contained in:
Deluan
2020-11-04 23:51:48 -05:00
parent a6bd9f627e
commit c9b119f0a4
+8 -1
View File
@@ -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))