Repository navigation
Conversation
…t device When `enable_streaming = "Auto"`, the client first queries the user's available Spotify Connect devices. If any device is already active, it skips the local librespot initialization and operates in Web API mode (remote control only). If no device is active, or the device query fails, it falls back to the existing `Always` path. This lets users with another Spotify Connect device active (phone, desktop, smart speaker) run the terminal client without spawning a second audio engine, while keeping a single uniform config knob. - config: add `Auto` variant to `StreamingType` and `RawStreamingType` - client: route `Auto` through `available_devices()` in `new_session` No behavior change for `Always` / `DaemonOnly` / `Never`.
…to streaming The Auto streaming mode currently treats any device with is_active == true as evidence that something is already playing, and skips local librespot initialization in favour of Web API remote control. A Spotify Connect device (e.g. an Amazon Echo linked to the user's account) reports is_active == true while it is idle in standby, which leaves the TUI with no local audio and surfaces the 'No playback found' message. Resolve Auto against both available_devices() and current_playback(): only enter Web API mode when a Connect device is actively playing. Any other case (no devices, devices online but idle, or a failed playback probe) falls back to the existing local librespot path, preserving the Always-style behaviour on error. This is a follow-up to aome510#1049. The fix is intentionally narrow: - public API unchanged - Default behaviour for Always / DaemonOnly / Never unchanged - Failure mode unchanged: any probe error falls back to local librespot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
enable_streamingcurrently acceptsAlways,DaemonOnly, andNever. There is no option for the common case where the user already has a Spotify Connect device active (phone, smart speaker, TV) and does not want the terminal client to spin up a second local audio engine.This PR adds
Auto, with one important refinement discovered during local validation:Autois selected, the client queries bothavailable_devices()andcurrent_playback(). Web API remote-control mode is only entered when both signals agree: a Connect device reportsis_active == trueand the user's account currently reportsis_playing == true. Any other case (no devices, devices online but idle, or a failed playback probe) falls back to the existingAlwayspath and boots a local librespot session.Typical use case: an Amazon Echo linked to the user's account is sitting idle in another room. Opening the terminal client on the laptop should pair audio locally, not defer to the standby Echo.
Background
The initial scope of this PR used
is_activealone as the disambiguator. Local validation against a real account showed that a Connect device which is online but idle still reportsis_active == true, which would leave the TUI in Web API remote-control mode with no local audio engine and surface a misleadingNo playback foundmessage. Cross-referencingcurrent_playback().is_playingrules out that case without re-introducing the original problem the user wanted to avoid (a second audio engine while a real device is playing).The fix is intentionally narrow:
is_active == true && is_playing == true→ Web API mode (existing behaviour).is_active == false(no devices, or all idle) → local librespot.is_active == true && is_playing == false(online device, idle account) → local librespot.available_devices()error orcurrent_playback()error → local librespot, with atracing::warn!explaining which probe failed. This preserves theAlways-style fallback semantics.Changes
This PR adds only the
is_active && is_playingdisambiguation. The baseAutoenum variant and its branches live in #1049.client/mod.rs::new_session()— refines theAutobranch from feat+fix(config): add Auto streaming mode with is_active && is_playing disambiguation #1049. Instead of usingis_activealone, the new branch cross-referencesavailable_devices()withcurrent_playback()and only enters Web API mode when both signals agree. Any disagreement (or probe failure) falls back to local librespot with atracing::warn!explaining which probe failed.Compatibility
Always; existing users see no behaviour change.enable_streaming = "Auto"is now a valid value. Existingtrue/false,Always,DaemonOnly, andNevercontinue to work identically.StreamingTypeis a public enum and adding a variant is additive.Validation
All three pass clean. Full release build also succeeds (
cargo build --release --features streaming,image,notify,media-control,rodio-backend,fzf).Repro / environment
Verified by the reporter on:
aome510/spotify-player@feat/streaming-auto-modeat9df680b, Cargo.toml version0.24.1feat/streaming-auto-mode(this PR adds the fix on top of feat+fix(config): add Auto streaming mode with is_active && is_playing disambiguation #1049 and cannot be merged until feat+fix(config): add Auto streaming mode with is_active && is_playing disambiguation #1049 lands)6.19.14+deb14-amd64)TERM_PROGRAM=ghostty)cargo build --release --features streaming,image,notify,media-control,rodio-backend,fzfthen launched from adistrobox enter arch-loustArch containerNCSPOT_CLIENT_IDconstant)~/.config/spotify-player/app.toml):enable_streaming = "Auto",enable_audio_visualization = true,enable_notify = true,enable_media_control = trueLocal log evidence (sanitized — track names and URIs removed, identifiers kept) showing the fix correctly identifying an idle Echo and falling back to local librespot:
Notes
is_active && is_playingpredicate makesAutomode robust against standby devices that are online but not playing. Users who only want the local player regardless of Connect state can still useAlways.Alwaysrather than failing startup. Duplicate audio is preferable to a client that won't start.is_activelives in feat+fix(config): add Auto streaming mode with is_active && is_playing disambiguation #1049's branch; this branch stacks theis_active && is_playingrefinement on top of it.