Repository navigation
Replace sonor with sinuous-client - #167
Merged
Merged
Conversation
Talk to the speakers through their local websocket API, using the sinuous-client crate, instead of UPnP through sonor. Commands are routed to the right player by sinuous_client::Household, and the group list now follows topology changes made from other controllers. The websocket API has no way of reading the queue, so the Queue view now shows the current and next tracks. The Favorites view lists all favorites (not just playlists) and plays them with loadFavorite. Also fix Shift-Tab (crossterm reports it as BackTab), selecting the previous group from the first one, and empty tracks reported by suspended Spotify Connect sessions showing as "Unknown". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The view mode, selected group and favorites cursor now live in the UI, so navigating no longer waits for the speakers. The service publishes a HouseholdState snapshot on a watch channel, and the UI tells it which group to keep up to date. Commands now name the group (and favorite) they apply to, and run one at a time in their own task, so that a slow speaker doesn't hold up state updates or key handling. The UI also shows a screen while connecting, why connecting failed, and errors from commands and refreshes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Discovery used to wait for its whole 2s timeout before connecting to anything, although players answer within a few hundred milliseconds. Use sinuous_client::discover_stream (new in sinuous-client 0.1.1) to connect to the first player as soon as it answers, which brings the time to the first screen from about 2.8s down to under 1s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The service used to poll the selected group every second. It now subscribes to the playback, metadata and volume events of every group, and to favorites events, and keeps the state up to date from them: - Subscriptions run in the background, as they may need to connect to other speakers, and are made again for groups that appear in the topology or change coordinator. - Favorites are fetched when their version changes, including from the initial event sent on subscription. - Speakers re-send their whole state when subscribed to again, so the service does that every minute and when it misses events, to catch up with anything lost, e.g. on a dropped connection. - Commands no longer trigger a refresh: the speakers send events about what changed. As speakers only report the playback position when something changes, the UI works it out from the last one reported, and redraws on a timer while it advances or an error is shown. The UI no longer needs to tell the service which group it shows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Household::connection is now async, as it reconnects to the player if the connection was lost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since 0.2.0, the household restores subscriptions when a connection drops, and moves group subscriptions to the group's new coordinator. So there is no need to resubscribe every minute, or on coordinator changes. Subscriptions that failed (which the household doesn't keep) are still retried periodically, and everything is still resubscribed to when events are missed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Switch from UPnP via
sonorto the speakers' local websocket API through thesinuous-clientcrate, and build on it.Changes
sinuous_client::Household, and the group list now picks up topology changes made from other controllers. The websocket API can't read the queue, so the Queue view now shows the current and next tracks. The Favorites view lists every favorite (not just playlists) and plays them withloadFavorite. This commit also fixes Shift-Tab (BackTab), selecting the previous group from the first one, and empty Spotify Connect tracks showing as "Unknown".HouseholdStatesnapshot on a watch channel. Each command runs in its own task, one at a time, so a slow speaker no longer holds up the UI. There are new screens for connecting, for a failed connection, and for errors.discover_stream, which cuts the time to the first screen from about 2.8s to under 1s.Testing
cargo clippy --all-targets: no issuescargo test: passes🤖 Generated with Claude Code