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

A "PlaybackStopEvent" should be fired on track changes #100

Open
ilya-zlobintsev opened this issue Apr 1, 2021 · 5 comments · Fixed by #101 · May be fixed by #103
Open

A "PlaybackStopEvent" should be fired on track changes #100

ilya-zlobintsev opened this issue Apr 1, 2021 · 5 comments · Fixed by #101 · May be fixed by #103

Comments

@ilya-zlobintsev
Copy link

ilya-zlobintsev commented Apr 1, 2021

This is needed for last.fm scrobbling to work properly.

Here is a detailed description of the last.fm plugin behaviour:
jesseward/jellyfin-plugin-lastfm#27 (comment)

@ilya-zlobintsev
Copy link
Author

I'm sorry, but this doesn't seem to work for me. I'm using the latest version and scrobbling still doesn't work. Activity on the server dashboard when playing with mopidy looks like this:
image
When playing from the web (not sure why the entry is doubled):
image

I'm running mopidy 3.1.1 if that makes any difference.

@mcarlton00
Copy link
Member

Looks like I need to adjust the stop playback command I'm sending. The server is reporting

Jellyfin.Server.Implementations.Events.Consumers.Session.PlaybackStopLogger: PlaybackStopped reported with null media info.

It must need to know the exact media item that it stopped. Which seems dumb, since obviously a client can only be playing one thing at a time. But whatever, shouldn't be a hard fix.

@mcarlton00 mcarlton00 reopened this Apr 19, 2021
@mcarlton00 mcarlton00 linked a pull request Apr 20, 2021 that will close this issue
@ilya-zlobintsev
Copy link
Author

@mcarlton00 I've tried the PR and it does properly show up in activity now, but scrobbling still doesn't work. Looking at the server logs it doesn't seem to report the playback duration properly:
Playback stopped reported by app "Mopidy" "1.0.3" playing "Mirror Mirror". Stopped at "0" ms

@mcarlton00
Copy link
Member

Hmm, that's going to complicate this a fair bit. Looking at the web client, it actually sends 2 stop commands. The first one has a PositionTicks value, the second one has it set to 0.

The reason this is an issue here is because we have to hook into Mopidy's playback system, which means we have to workaround whatever they're doing. In this case, when we get the notification that a track has changed, mopidy provides a data payload of {'old_state': 'playing, 'new_state': 'playing'}. You may notice that this is a little lacking on vital information that we need for reporting. Pulling the item id is doable, if kinda messy. Playback ticks is going to be a bit of a trick and I'm not sure how to get that yet. It can be pulled during playback of a given item, but by the time we receive the track changed notification, we would be pulling the playback position of the next item, not the one that we're looking for. So right now I'm not sure how to pull that off.

@ilya-zlobintsev
Copy link
Author

If anyone comes across this, you can use mopidy-scrobbler as a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants