[PR #371] [MERGED] Don't create streaming connections for non-streaming instances #1676

Closed
opened 2026-03-14 15:26:56 +03:00 by kerem · 0 comments
Owner

📋 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: masterHead: fix-new-streaming-session


📝 Commits (4)

  • 357a0d6 refactor: move is_daemon to State
  • f1d959d chore: introduce is_streaming_enabled helper
  • ad4693a fix: always check if streaming is enabled before creating a new streaming
  • 6d870be Fix 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_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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/aome510/spotify-player/pull/371 **Author:** [@Schnouki](https://github.com/Schnouki) **Created:** 2/13/2024 **Status:** ✅ Merged **Merged:** 2/15/2024 **Merged by:** [@aome510](https://github.com/aome510) **Base:** `master` ← **Head:** `fix-new-streaming-session` --- ### 📝 Commits (4) - [`357a0d6`](https://github.com/aome510/spotify-player/commit/357a0d67fb9032b116b4bd9f83449d79251f4ef4) refactor: move is_daemon to State - [`f1d959d`](https://github.com/aome510/spotify-player/commit/f1d959d77b5caadcf16f3e9f641ad9777861fb2e) chore: introduce is_streaming_enabled helper - [`ad4693a`](https://github.com/aome510/spotify-player/commit/ad4693a2ffe4cbdf967c2518777d2f32be144217) fix: always check if streaming is enabled before creating a new streaming - [`6d870be`](https://github.com/aome510/spotify-player/commit/6d870be27f567246afd47eab0ae647e803ab778e) Fix clippy error ### 📊 Changes **3 files changed** (+25 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `spotify_player/src/client/mod.rs` (+1 -1) 📝 `spotify_player/src/main.rs` (+14 -20) 📝 `spotify_player/src/state/mod.rs` (+10 -1) </details> ### 📄 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_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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-14 15:26:56 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-player#1676
No description provided.