mirror of
https://github.com/aome510/spotify-player.git
synced 2026-04-26 09:25:49 +03:00
[PR #371] [MERGED] Don't create streaming connections for non-streaming instances #1676
Labels
No labels
bug
documentation
enhancement
good first issue
help wanted
pull-request
question
third-party
third-party
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-player#1676
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/aome510/spotify-player/pull/371
Author: @Schnouki
Created: 2/13/2024
Status: ✅ Merged
Merged: 2/15/2024
Merged by: @aome510
Base:
master← Head:fix-new-streaming-session📝 Commits (4)
357a0d6refactor: move is_daemon to Statef1d959dchore: introduce is_streaming_enabled helperad4693afix: always check if streaming is enabled before creating a new streaming6d870beFix clippy error📊 Changes
3 files changed (+25 additions, -22 deletions)
View changed files
📝
spotify_player/src/client/mod.rs(+1 -1)📝
spotify_player/src/main.rs(+14 -20)📝
spotify_player/src/state/mod.rs(+10 -1)📄 Description
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_streamingis correctly checked againstis_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_daemonbool tostate, added a helper to checkenable_streamingagainstis_daemoncorrectly, 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.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.