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

Don't create streaming connections for non-streaming instances #371

Merged
merged 4 commits into from
Feb 15, 2024

Conversation

Schnouki
Copy link
Contributor

This fixes an issue I've been having for a little while.

For context: I'm running spotify_player in daemon mode with enable_streaming = "DaemonOnly", and another instance to control the daemon.
From time to time, however, things get weird, with several devices with the same name showing in the UI. This typically happens after my laptop goes to sleep and wakes up on a different wifi network.

The reason is that during the app init, enable_streaming is correctly checked against is_daemon, but isn't checked again when the session needs to be restarted. So, when the TUI recreates a session, it also creates a new streaming connection, resulting in 2 devices with the same name in the UI, and no way to tell them apart and know if the TUI or the daemon was actually used.

To fix this, I moved the is_daemon bool to state, added a helper to check enable_streaming against is_daemon correctly, and used it everywhere it's required. I've been running this for several days without having this issue again.

Did that before #370, so there was an extra place where is_streaming_enabled() was needed, but I don't think this will change anything.

@aome510 aome510 merged commit d1b2314 into aome510:master Feb 15, 2024
4 checks passed
@Schnouki Schnouki deleted the fix-new-streaming-session branch February 15, 2024 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants