mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-02 02:43:33 +00:00
bugfix: remove duplicate scrobbling when there is only one item in the queue (#1222)
This commit is contained in:
parent
ff0ca09644
commit
58ccd0cfd0
1 changed files with 6 additions and 1 deletions
|
|
@ -268,6 +268,7 @@ export const useScrobble = () => {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const isLastTrackInQueue = usePlayerStore.getState().actions.checkIsLastTrack();
|
const isLastTrackInQueue = usePlayerStore.getState().actions.checkIsLastTrack();
|
||||||
|
const isFisrtTrackInQueue = usePlayerStore.getState().actions.checkIsFirstTrack();
|
||||||
const previousTimeSec = previous[1];
|
const previousTimeSec = previous[1];
|
||||||
|
|
||||||
// If not already scrobbled, send a 'submission' scrobble if conditions are met
|
// If not already scrobbled, send a 'submission' scrobble if conditions are met
|
||||||
|
|
@ -275,8 +276,12 @@ export const useScrobble = () => {
|
||||||
scrobbleAtDurationMs: (scrobbleSettings?.scrobbleAtDuration ?? 0) * 1000,
|
scrobbleAtDurationMs: (scrobbleSettings?.scrobbleAtDuration ?? 0) * 1000,
|
||||||
scrobbleAtPercentage: scrobbleSettings?.scrobbleAtPercentage,
|
scrobbleAtPercentage: scrobbleSettings?.scrobbleAtPercentage,
|
||||||
// If scrobbling the last song in the queue, use the previous time instead of the current time since otherwise time value will be 0
|
// If scrobbling the last song in the queue, use the previous time instead of the current time since otherwise time value will be 0
|
||||||
|
// Note that if the queue has one item (both first and last), use the elapsed time, as this will otherwise result
|
||||||
|
// in duplicate scrobbles in tandem with handleScrobbleFromSongChange
|
||||||
songCompletedDurationMs:
|
songCompletedDurationMs:
|
||||||
(isLastTrackInQueue ? previousTimeSec : currentTimeSec) * 1000,
|
(isLastTrackInQueue && !isFisrtTrackInQueue
|
||||||
|
? previousTimeSec
|
||||||
|
: currentTimeSec) * 1000,
|
||||||
songDurationMs: currentSong.duration,
|
songDurationMs: currentSong.duration,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue