jeffvli / sonixd

A full-featured Subsonic/Jellyfin compatible desktop music player
GNU General Public License v3.0
1.87k stars 73 forks source link

Fix now playing notifications being off by one #364

Closed kgarner7 closed 2 years ago

kgarner7 commented 2 years ago

This seeks to fix #362. Instead of using playerQueue.current, use the same logic for scrobbling.

I'm not sure whether the current-song event should also use currentSong or not?

jeffvli commented 2 years ago

current-song is used for both MPRIS as well as the Windows MediaPlaybackStatus. Strangely enough, I don't see any issues with it being off by one when using playQueue.current (at least on Windows) so you can leave it as is.

If you're able to test if MPRIS is off by one that would be helpful, but otherwise this should be good to merge.

kgarner7 commented 2 years ago

MPRIS from this function is probably also off, but it isn't noticeable because of handleOnEndedPlayer1 and 2, which also send to MPRIS with the next song. The correct thing to do would probably be to just use currentSong, but I'm not sure it matters