jeffvli / feishin

A modern self-hosted music player.
https://feishin.vercel.app
GNU General Public License v3.0
1.97k stars 77 forks source link

Pausing a track generates intermittent scrobble spam #394

Closed nathan-contino closed 2 months ago

nathan-contino commented 6 months ago

Expected Behavior

When I press the play/pause button in macOS, I expect the track to stop playing and scrobbling.

Current Behavior

Currently, the track does stop playing, but the equalizer icon on the track itself in the track list continues to animate and the play/pause button at the bottom of the screen continues to show the two vertical bar "pause" option (when the track is actually paused -- for instance, after pressing the pause button on screen -- this button should change state to the sideways triangle play button to reflect that clicking the button will begin playing the track).

Even worse, Feishin intermittently scrobbles the currently not-really-paused track to Jellyfin roughly every 7 or 8 minutes, and thus my last.fm account. This generates a lot of spam in my scrobbles! Scrobbles even seem to persist through sleep on my laptops, though on an hourly cadence instead of every 7 or 8 minutes.

Last.fm scrobble evidence:

Screenshot 2023-11-30 at 10 08 51 Screenshot 2023-11-30 at 10 11 45

I do not know if this issue exists on other platforms, but it definitely exists on macOS.

Steps to Reproduce

  1. Pause a track with scrobbling enabled when connected to a Jellyfin instance that scrobbles to last.fm. I can't tell if it matters where you pause the track.

  2. Wait 20 minutes; you should see 2 or 3 scrobbles.

Possible Solution (Not obligatory)

You know better than me.

Context

It made me sad to have to manually delete a thousand spam scrobbles from my last.fm account when I discovered it. This issue didn't exist on Sonixd, which I used until a couple of months ago, so fortunately I only had to clean a couple of months worth of scrobbles.

Your Environment

nathan-contino commented 6 months ago

Managed to replicate the issue again last night. I assure you, I'm not quite this big a Rush fan:

Feishin player state (note that the play/pause button shows the pause option, even though the music is already paused):

Screenshot 2023-12-01 at 09 25 25

Scrobble history from last night, laptop in sleep mode:

Screenshot 2023-12-01 at 09 25 17

My scrobble settings in Feishin:

Screenshot 2023-12-01 at 09 30 17

(enabled, 90%, and currently set to 160 seconds minimum play time. Though an additional piece of feedback: it's unclear how the minimum percent and minimum time settings work -- I assume the minimum setting of the two controls when the track scrobbles? e.g. 90% and 60 seconds always scrobbles at 60 seconds unless you listen to a song less than 66 seconds long, when the percentage kicks in as the actual minimum?)

So it might be better to rename this "keyboard pause button doesn't actually pause". FWIW clicking the virtual play/pause or stop buttons doesn't seem to result in the same issue, so it seems like the keyboard button handler has a subtle bug.

jeffvli commented 6 months ago

I assume the minimum setting of the two controls when the track scrobbles? e.g. 90% and 60 seconds always scrobbles at 60 seconds unless you listen to a song less than 66 seconds long, when the percentage kicks in as the actual minimum?)

Yep, that's correct.


Thanks for looking into this. I'll try to reproduce this on my side soon and see if I can implement a fix.

nathan-contino commented 6 months ago

Thanks! For anyone else seeing this issue, I've found that setting "seconds" to a high number (like 1000) and "percentage" to the maximum (90% in this version) seems to mitigate the issue: I suspect that as long as you're beneath the minimum scrobble threshold when you pause the song, you won't see this problem. Unfortunately if you listen to a lot of artists with long songs, it's easy to pause in the "danger zone" after the default 60%/240 second mark!

kgarner7 commented 4 months ago

Managed to replicate the issue again last night. I assure you, I'm not quite this big a Rush fan:

Feishin player state (note that the play/pause button shows the pause option, even though the music is already paused): Screenshot 2023-12-01 at 09 25 25 Scrobble history from last night, laptop in sleep mode:

Screenshot 2023-12-01 at 09 25 17

My scrobble settings in Feishin: Screenshot 2023-12-01 at 09 30 17 (enabled, 90%, and currently set to 160 seconds minimum play time. Though an additional piece of feedback: it's unclear how the minimum percent and minimum time settings work -- I assume the minimum setting of the two controls when the track scrobbles? e.g. 90% and 60 seconds always scrobbles at 60 seconds unless you listen to a song less than 66 seconds long, when the percentage kicks in as the actual minimum?)

So it might be better to rename this "keyboard pause button doesn't actually pause". FWIW clicking the virtual play/pause or stop buttons doesn't seem to result in the same issue, so it seems like the keyboard button handler has a subtle bug.

This latter point is fixed by the PR associated with https://github.com/jeffvli/feishin/actions/runs/7939011303. For MacOS, you need to be a trusted accessibility client to control media keys (otherwise, it would go to mpv, bypassing Feishin entirely). Can you please try this to confirm that you see the correct media state?

kgarner7 commented 2 months ago

As there have not been any updates, and the included PR has been merged I will close this issue.