Use trackId instead of simply id, as it seems to conflict with internal id generated by the player. fixes #153

This commit is contained in:
Deluan
2020-04-07 11:55:45 -04:00
parent 7e6c0e3894
commit f537984bbf
2 changed files with 7 additions and 6 deletions
+5 -5
View File
@@ -58,17 +58,17 @@ const Player = () => {
if (isNaN(info.duration) || progress < 90) { if (isNaN(info.duration) || progress < 90) {
return return
} }
const item = queue.queue.find((item) => item.id === info.id) const item = queue.queue.find((item) => item.trackId === info.trackId)
if (item && !item.scrobbled) { if (item && !item.scrobbled) {
dispatch(scrobbled(info.id)) dispatch(scrobbled(info.trackId))
subsonic.scrobble(info.id, true) subsonic.scrobble(info.trackId, true)
} }
} }
const OnAudioPlay = (info) => { const OnAudioPlay = (info) => {
if (info.duration) { if (info.duration) {
subsonic.scrobble(info.id, false) subsonic.scrobble(info.trackId, false)
dataProvider.getOne('keepalive', { id: info.id }) dataProvider.getOne('keepalive', { id: info.trackId })
} }
} }
+2 -1
View File
@@ -9,6 +9,7 @@ const PLAYER_PLAY_ALBUM = 'PLAYER_PLAY_ALBUM'
const mapToAudioLists = (item) => ({ const mapToAudioLists = (item) => ({
id: item.id, id: item.id,
trackId: item.id,
name: item.title, name: item.title,
singer: item.artist, singer: item.artist,
cover: subsonic.url('getCoverArt', item.id, { size: 300 }), cover: subsonic.url('getCoverArt', item.id, { size: 300 }),
@@ -60,7 +61,7 @@ const playQueueReducer = (
const newQueue = previousState.queue.map((item) => { const newQueue = previousState.queue.map((item) => {
return { return {
...item, ...item,
scrobbled: item.scrobbled || item.id === data scrobbled: item.scrobbled || item.trackId === data
} }
}) })
return { queue: newQueue, clear: false } return { queue: newQueue, clear: false }