Skip to content

Conversation

@LiboShen
Copy link
Contributor

Add support for browsing and playing Sonos favorite playlists/albums directly from the TUI.

Features:

  • Fetch and display favorite playlists from Sonos speakers
  • Two-view interface: Queue (1) and Favorites (2)
  • Navigate favorites with arrow keys (up/down or j/k)
  • Play favorites by pressing Enter
  • Support for various playlist types including YouTube Music
  • Optimized state updates with caching to prevent UI hangs
  • Batch command processing to improve responsiveness

Implementation details:

  • Added FavoritePlaylist struct to represent Sonos favorites
  • Implemented ContentDirectory browsing via UPnP actions
  • Added ViewMode enum for switching between Queue and Favorites views
  • Enhanced SpeakerState with favorites list and navigation state
  • Improved command handling with batching and state caching
  • Added proper XML parsing for Sonos playlist metadata

Technical notes:

  • Uses Arc and Arc<Vec> for efficient state sharing since sonor crate types don't implement Clone. Arc allows cheap cloning via reference counting instead of expensive data duplication on every state update (which happens every second).

Hi! Thank you for creating this awesome project and lay a solid foundation.

I understand that this PR makes some product decisions (like the two-view interface and keyboard
shortcuts), and I'm completely open to suggestions or changes if you'd like things done differently.
I'd like to have a snappy TUI experience for controlling my Sonos speakers and therefore I found this
project

I'd love to see this merged if it aligns with your vision for the project, but also totally happy to
maintain it as a personal fork if you prefer to keep full control over the direction. Either way works for
me.

Add support for browsing and playing Sonos favorite playlists/albums directly from the TUI.

Features:
- Fetch and display favorite playlists from Sonos speakers
- Two-view interface: Queue (1) and Favorites (2)
- Navigate favorites with arrow keys (up/down or j/k)
- Play favorites by pressing Enter
- Support for various playlist types including YouTube Music
- Optimized state updates with caching to prevent UI hangs
- Batch command processing to improve responsiveness

Implementation details:
- Added FavoritePlaylist struct to represent Sonos favorites
- Implemented ContentDirectory browsing via UPnP actions
- Added ViewMode enum for switching between Queue and Favorites views
- Enhanced SpeakerState with favorites list and navigation state
- Improved command handling with batching and state caching
- Added proper XML parsing for Sonos playlist metadata

Technical notes:
- Uses Arc<TrackInfo> and Arc<Vec<Track>> for efficient state sharing
  since sonor crate types don't implement Clone. Arc allows cheap cloning
  via reference counting instead of expensive data duplication on every
  state update (which happens every second).
Copy link
Owner

@abusch abusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the PR! This little definitely needs a bit of love... one thing I'd like to do is to use subscriptions/events instead of polling for the state all the time, and maybe switch to wez-sonos instead of sonor as it seems much more complete.

But given I don't know when/if I'll do all that, I'm happy to merge this for now :)

@abusch abusch merged commit 9e1129c into abusch:main Nov 30, 2025
1 check passed
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