Skip to content

Commit

Permalink
Use trackId instead of simply id, as it seems to conflict with in…
Browse files Browse the repository at this point in the history
…ternal id generated by the player. fixes #153
  • Loading branch information
deluan committed Apr 7, 2020
1 parent 7e6c0e3 commit f537984
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions ui/src/audioplayer/Player.js
Expand Up @@ -58,17 +58,17 @@ const Player = () => {
if (isNaN(info.duration) || progress < 90) {
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) {
dispatch(scrobbled(info.id))
subsonic.scrobble(info.id, true)
dispatch(scrobbled(info.trackId))
subsonic.scrobble(info.trackId, true)
}
}

const OnAudioPlay = (info) => {
if (info.duration) {
subsonic.scrobble(info.id, false)
dataProvider.getOne('keepalive', { id: info.id })
subsonic.scrobble(info.trackId, false)
dataProvider.getOne('keepalive', { id: info.trackId })
}
}

Expand Down
3 changes: 2 additions & 1 deletion ui/src/audioplayer/queue.js
Expand Up @@ -9,6 +9,7 @@ const PLAYER_PLAY_ALBUM = 'PLAYER_PLAY_ALBUM'

const mapToAudioLists = (item) => ({
id: item.id,
trackId: item.id,
name: item.title,
singer: item.artist,
cover: subsonic.url('getCoverArt', item.id, { size: 300 }),
Expand Down Expand Up @@ -60,7 +61,7 @@ const playQueueReducer = (
const newQueue = previousState.queue.map((item) => {
return {
...item,
scrobbled: item.scrobbled || item.id === data
scrobbled: item.scrobbled || item.trackId === data
}
})
return { queue: newQueue, clear: false }
Expand Down

0 comments on commit f537984

Please sign in to comment.