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 · 5 comments
Open

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

eladyn opened this issue Jan 4, 2025 · 5 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).

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

2 participants