Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jellyfin Scrobbling: Listening to a song records it 2x+ times #126

Closed
BrennanAyers opened this issue Dec 11, 2021 · 5 comments · Fixed by #127
Closed

Jellyfin Scrobbling: Listening to a song records it 2x+ times #126

BrennanAyers opened this issue Dec 11, 2021 · 5 comments · Fixed by #127
Assignees
Labels
bug Something isn't working jellyfin Relates to Jellyfin functionality or API
Projects

Comments

@BrennanAyers
Copy link

Describe the bug
With Scrobbling turned on, and listening to songs from a Jellyfin server, it appears to count each listen multiple times.

To Reproduce
Steps to reproduce the behavior:

x. Turn on scrobbling

  1. Go to any song
  2. Click on said song to play it
  3. Wait long enough for it to count as a "play" (I swear I saw this logic somewhere, but can't remember)
  4. Navigate away and click back into the album to refresh the playcount (observe the n+1 from what it was before)
  5. Wait until the song gets to somewhere around 80%-90% finished
  6. Navigate away and click back into the album to refresh the playcount again (observe the n+2 from what it was before you played the song in the first place)
  7. If the song happens to be a single (only track on an album), when it's done playing it might replay and count as a 3rd play

Expected behavior
After hitting the threshold of "played", the count would go up by 1

Screenshots
(I've been meaning to get a dev version up and running so I could provide a bit more context, but) Here's the track I was playing, and about as I could get to when it flipped over to 2 plays
image

Desktop (please complete the following information):

  • OS: Windows 10 LTSC 212H
  • Version 0.9.1

Additional context
Single tracks on albums replaying automatically is a separate issue that I should probably put elsewhere.

@BrennanAyers BrennanAyers added the bug Something isn't working label Dec 11, 2021
@jeffvli
Copy link
Owner

jeffvli commented Dec 11, 2021

Thanks for opening this.

I noticed there were additional issues the lastfm scrobbling on Jellyfin but didn't realize the play count was being recorded multiple times as well.
I'll take a look at the scrobbling again to see what Jellyfin determines as a finished track.

@jeffvli jeffvli self-assigned this Dec 11, 2021
@jeffvli
Copy link
Owner

jeffvli commented Dec 11, 2021

Seems like Jellyfin marks the song as "Played" (adds 1 to the play count) when sending the /Sessions/Playing request. On the default Jellyfin web UI this request is sent as soon as a song is started, which means that if you quickly skip through songs with the Next track button, every song that is skipped will immediately add a play count to it.

I'm thinking it would be better to have it only when the song is completed (90% listened or past 4 minutes) which is consistent with the lastfm scrobble. Thoughts?

@BrennanAyers
Copy link
Author

Yeah, that's kind of what I was expecting, that once you listened to at least most of the song it would count. Plenty of times where you're just flipping through and don't want it to go up. If Last.fm does 90%, I agree to stick with that!

jeffvli added a commit that referenced this issue Dec 11, 2021
- Remove /sessions/playing (lastfm plugin will no longer show currently playing)
- Add pause event for crossfade players
- Add debounce to seek slider with puase/play events for jellyfin
@jeffvli jeffvli added this to To do in 0.10.0 via automation Dec 11, 2021
@jeffvli jeffvli moved this from To do to Done in 0.10.0 Dec 11, 2021
@jeffvli jeffvli added the jellyfin Relates to Jellyfin functionality or API label Dec 11, 2021
@maltechx
Copy link

I just wanted to mention that I encountered a few issues that somehow relate to this one:

  • After ~4 minutes of playing a song the playback in Jellyfin is marked as stopped.
  • Stopping a song does not stop the reported playback time in Jellyfin. (The time counts up)

Also the Last.fm plugin marks a song as played after 100%, when its played in the web player. (Maybe there is an option to change that)

@jeffvli
Copy link
Owner

jeffvli commented Dec 12, 2021

@maltechx

After ~4 minutes of playing a song the playback in Jellyfin is marked as stopped.

This is due to the crossfade player implementation and how the scrobbling was implemented for Subsonic-API servers. For Subsonic, a scrobble request is sent when the player reaches the scrobble condition (check the docs for the conditions).

In the case of Jellyfin, I replaced it with the stop playback request which the jellyfin lastfm plugin uses to determine whether or not to send "song completed" message to lastfm.

Stopping a song does not stop the reported playback time in Jellyfin. (The time counts up)

It should stop properly when in gapless mode (crossfade duration = 0), but there's a bug when crossfade is enabled. It's fixed in #127 and should go out with the next release though.

Also the Last.fm plugin marks a song as played after 100%, when its played in the web player. (Maybe there is an option to change that)

The plugin is checking the stop playback request that I mentioned earlier and checking at what time position the track was stopped at to determine whether or not to send the request. The actual play counts that Jellyfin server records is separate from the lastfm scrobble though.

https://github.com/jesseward/jellyfin-plugin-lastfm/blob/c2db0ec38291b13053aa59d502a3e292b00d644b/Jellyfin.Plugin.Lastfm/ServerEntryPoint.cs#L22-L27

jeffvli added a commit that referenced this issue Dec 13, 2021
- Remove /sessions/playing (lastfm plugin will no longer show currently playing)
- Add pause event for crossfade players
- Add debounce to seek slider with puase/play events for jellyfin
jeffvli added a commit that referenced this issue Jan 28, 2022
- Prevents playCount increment when quickly skipping through songs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working jellyfin Relates to Jellyfin functionality or API
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants