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

PlayerEvent::ShuffleChanged and PlayerEvent::RepeatChanged not sent #1435

Open
eladyn opened this issue Jan 4, 2025 · 9 comments
Open

PlayerEvent::ShuffleChanged and PlayerEvent::RepeatChanged not sent #1435

eladyn opened this issue Jan 4, 2025 · 9 comments
Labels

Comments

@eladyn
Copy link
Contributor

eladyn commented Jan 4, 2025

Description

When pressing the shuffle or repeat button, the state is properly updated but not propagated through the PlayerEvent channel.

Version

dev 7003e98

How to reproduce

  1. Launch librespot --onevent env
  2. In the client click on shuffle or on repeat.
  3. Notice that no player events are being sent

Log

[2025-01-04T15:21:52Z INFO  librespot] librespot 0.6.0-dev 7003e98 (Built on 2025-01-04, Build ID: 8iRkyqq5, Profile: debug)
[2025-01-04T15:21:52Z INFO  librespot_playback::mixer::softmixer] Mixing with softvol and volume control: Log(60.0)
[2025-01-04T15:21:52Z INFO  librespot_playback::convert] Converting with ditherer: tpdf
[2025-01-04T15:21:52Z INFO  librespot_playback::audio_backend::rodio] Using Rodio sink with format S16 and cpal host: ALSA
[2025-01-04T15:21:52Z INFO  librespot_playback::audio_backend::rodio] Using audio device: default
[2025-01-04T15:22:05Z INFO  librespot_core::session] Connecting to AP "..."
[2025-01-04T15:22:05Z INFO  librespot_core::session] Authenticated as '...' !
[2025-01-04T15:22:05Z INFO  librespot_core::session] Country: "..."
[2025-01-04T15:22:05Z INFO  librespot_core::spclient] Resolved "..." as spclient access point
[2025-01-04T15:22:05Z INFO  librespot_connect::spirc] active device is <...> with session <>
play_request_id_changed
loading
[2025-01-04T15:22:06Z INFO  librespot_playback::player] Loading <People Help the People> with Spotify URI <spotify:track:0YywjDvFudcaHG74NuWISy>
[2025-01-04T15:22:06Z WARN  librespot_core::dealer] No subscriber for msg.uri: social-connect/v2/broadcast_status_update
[2025-01-04T15:22:06Z INFO  librespot_connect::spirc] session update: <Ok(NEW_SESSION)> for self, current session_id 3e5bbc6bd5354ac6bdd7e74c5dbe444f, new session_id dd62750b9479353ae46624eb8a356bf0
[2025-01-04T15:22:06Z ERROR librespot_connect::spirc] could not parse session_update: Invalid state { Unknown enum variant name: `WIFI_BROADCAST_CHANGED` at 1:11 }
[2025-01-04T15:22:06Z INFO  librespot_playback::player] <People Help the People> (256236 ms) loaded
track_changed
paused
playing
volume_changed
volume_changed
volume_changed
volume_changed
volume_changed
volume_changed
[2025-01-04T15:22:15Z INFO  librespot_connect::spirc] delayed volume update for all devices: volume is now 65535
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
play_request_id_changed
loading
[2025-01-04T15:22:21Z INFO  librespot_playback::player] Loading <1901> with Spotify URI <spotify:track:3CqOsjVamOisF8E0e9nPUo>
[2025-01-04T15:22:21Z INFO  librespot_playback::player] <1901> (311226 ms) loaded
track_changed
playing
[2025-01-04T15:22:22Z ERROR librespot_connect::spirc] could not dispatch connect state update: Resource has been exhausted { Response status code: 429 Too Many Requests }
seeked
[2025-01-04T15:22:35Z ERROR librespot_connect::spirc] could not dispatch connect state update: Resource has been exhausted { Response status code: 429 Too Many Requests }
[2025-01-04T15:22:41Z ERROR librespot_connect::spirc] could not dispatch connect state update: Resource has been exhausted { Response status code: 429 Too Many Requests }
[2025-01-04T15:22:45Z ERROR librespot_connect::spirc] failed to handle request: Resource has been exhausted { Response status code: 429 Too Many Requests }
[2025-01-04T15:22:51Z ERROR librespot_connect::spirc] failed to handle request: Resource has been exhausted { Response status code: 429 Too Many Requests }
preload_next
[2025-01-04T15:26:02Z INFO  librespot_playback::player] Loading <Skinny Love> with Spotify URI <spotify:track:4RL77hMWUq35NYnPLXBpih>
[2025-01-04T15:26:02Z INFO  librespot_playback::player] <Skinny Love> (201080 ms) loaded
preloading
end_of_track
play_request_id_changed
track_changed
playing
[2025-01-04T15:26:33Z ERROR librespot_connect::spirc] could not dispatch connect state update: Resource has been exhausted { Response status code: 429 Too Many Requests }
[2025-01-04T15:26:33Z ERROR librespot_connect::spirc] could not dispatch connect state update: Resource has been exhausted { Response status code: 429 Too Many Requests }

This is not a debug log, but I changed shuffle and repeat several times during this run, and that should trigger the onevent hook:

PlayerEvent::ShuffleChanged { shuffle } => {
env_vars.insert("PLAYER_EVENT", "shuffle_changed".to_string());
env_vars.insert("SHUFFLE", shuffle.to_string());
}

Host (what you are running librespot on):

  • OS: Linux
  • Platform: x86_64

Additional context

I'm not sure whether the various other errors in the log are intended currently, otherwise I could of course open bug reports for them as well. (In particular the Too Many Requests seems interesting, but also the unknown enum variant WIFI_BROADCAST_CHANGED.

@eladyn eladyn added the bug label Jan 4, 2025
@photovoltex
Copy link
Member

Huh, good find. Seems like that part was overlooked. Just to clarify the behavior, it only doesn't notify when we (librespot) are in control, right?

The other errors:

The WIFI_BROADCAST_CHANGED is an known error that doesn't break anything. But we should probably handle or fix it. Didn't bother yet as it doesn't break anything.

Too Many Requests is a failure that happens when to many request updates are send. That should be sorta fixed/improved with this PR #1414

@eladyn
Copy link
Contributor Author

eladyn commented Jan 4, 2025

Thanks for the reply!

I was looking through the code a bit and I think, the updates are only ever sent on activation of the session? So it wouldn't matter whether we cause or another client causes the update.

@photovoltex
Copy link
Member

Yeah seems like it. The previous calls where probably removed during the dealer rework and because they do not influence the overall connect handling it did run under the radar.

@eladyn
Copy link
Contributor Author

eladyn commented Jan 4, 2025

Makes sense. I could probably get around to creating a PR re-adding them by the end of next week or something, but if you or someone else is motivated, I would not mind either.

@photovoltex
Copy link
Member

Sounds good. You can check here (https://github.com/librespot-org/librespot/network) if anyone created a branch that sounds like the fix (I probably won't till some time passed).

@maraid
Copy link

maraid commented Jan 16, 2025

The WIFI_BROADCAST_CHANGED is an known error that doesn't break anything. But we should probably handle or fix it. Didn't bother yet as it doesn't break anything.

Hey! I just wanted to let you know my minor finding.
It does seem to break at least the sending of "session_connected" player events. You mentioned in #1419 (comment) that it might be caused by an out-of-date model, but it does work on master which indicates me that it the issue might lie elsewhere. Unfortunately I'm not really a rust person, so fixing it myself might prove difficult.

@photovoltex
Copy link
Member

It works on master or the latest release version (aka 0.6) because it isn't send there as they still use mecury to receive the connect session infos. With 0.6-dev, aka the dev branch we finally got around to implementing the dealer (#1356) which gives use more infos about the connect session and additonally more commands to handle. We also recently updated the protobuf extract to an up to date state, but sadly they didn't fix the problem in regards to the missing enum variant yet.

Anyhow this isn't the main issue at hand. So if you have any concerns about the warning/errors or want to fix them we should open a separate issue/PR for them :)

@radoslawg
Copy link

I have noticed setting a repeat playlist in the client does not work, and some random songs are played after the playlist is finished. I cannot fully follow the discussion, but would this issue be responsible for that? Strangely shuffling seems to work (using raspotify 0.46.1 with librespot 0.6.0 383a6f6 (Built on 2025-01-17, Build ID: jkYzFN5D, Profile: release) )

@photovoltex
Copy link
Member

This issue is related to the dev version. During the replaced of mercury with the dealer it seems we removed to much and by that this issue was created.

What you are referring to, might be already fixed on the dev branch But you should probably create a separate issue anyways on the matter, so that we can investigate the issue and check if it is resolved with the current version :)

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

No branches or pull requests

4 participants