From 50eb7ef1bc1fbd873ee113893950ede5a326bc58 Mon Sep 17 00:00:00 2001 From: Kendall Garner <17521368+kgarner7@users.noreply.github.com> Date: Mon, 25 Jul 2022 19:08:31 +0000 Subject: [PATCH] Song from playerNumber instead of current (#364) --- src/components/player/Player.tsx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/components/player/Player.tsx b/src/components/player/Player.tsx index f78b8ec..8ff7de5 100644 --- a/src/components/player/Player.tsx +++ b/src/components/player/Player.tsx @@ -615,15 +615,20 @@ const Player = ({ currentEntryList, muted, children }: any, ref: any) => { const handleOnPlay = useCallback( (playerNumber: 1 | 2) => { + const currentSong = + playerNumber === 1 + ? playQueue[currentEntryList][playQueue.player1.index] + : playQueue[currentEntryList][playQueue.player2.index]; + ipcRenderer.send('current-song', playQueue.current); - if (config.player.systemNotifications) { + if (config.player.systemNotifications && currentSong) { // eslint-disable-next-line no-new - new Notification(playQueue.current.title, { - body: `${playQueue.current.artist.map((artist: Artist) => artist.title).join(', ')}\n${ - playQueue.current.album + new Notification(currentSong.title, { + body: `${currentSong.artist.map((artist: Artist) => artist.title).join(', ')}\n${ + currentSong.album }`, - icon: playQueue.current.image, + icon: currentSong.image, }); } @@ -637,10 +642,7 @@ const Player = ({ currentEntryList, muted, children }: any, ref: any) => { serverType: config.serverType, endpoint: 'scrobble', args: { - id: - playerNumber === 1 - ? playQueue[currentEntryList][playQueue.player1.index]?.id - : playQueue[currentEntryList][playQueue.player2.index]?.id, + id: currentSong?.id, submission: false, position: currentSeek * 1e7, event: 'unpause',