jeffvli / feishin

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

Last track in playback queue is scrobbled with no time #736

Open lyarenei opened 2 months ago

lyarenei commented 2 months ago

Expected Behavior

Last track is reported with whatever time the playback of that track stopped on the client side, just like they are when not last in the playback queue.

Current Behavior

Last track in playback queue is scrobbled with 0 time. This also applies to playback queue with one track.

Relevant example entry in Jellyfin log:

[2024-09-08 15:51:11.504 +02:00] [INF] [45] Emby.Server.Implementations.Session.SessionManager   : Playback stopped reported by app "Feishin" "0.8.1" playing "- An Ending -". Stopped at "0" ms

Steps to Reproduce

  1. Enqueue 1 or more tracks for playback (album, few songs, whatever).
  2. Wait for playback finish
  3. Observe first to n-1 tracks being scrobbled with correct time
  4. Observe last track being scrobbled with 0 time

Possible Solution

Did not look at the code, at least not yet.

My guess is that it's probably something with losing the playback state of the player when the playback queue is empty before the scrobble of the last track is made.

Context

Last played track is scrobbled with invalid time, causing Jellyfin plugins like ListenBrainz to miss the scrobble as they may evaluate the playback stop time position as well.

Scrobble settings in Feishin: 50%, 240s

I have also noticed that playback is not scrobbled at all when manually stopping the playback, evne when the scrobble limits are met (I'll create a separate report if that's preferred).

Application version

0.8.1

Operating System and version

Linux, appimage

Server and Version

Jellyfin 10.9.10

Node Version (if developing locally)

No response