Skip to content

Add add_to_queue to Spirc#1676

Merged
photovoltex merged 9 commits intolibrespot-org:devfrom
ralph:add-to-queue
Jan 21, 2026
Merged

Add add_to_queue to Spirc#1676
photovoltex merged 9 commits intolibrespot-org:devfrom
ralph:add-to-queue

Conversation

@ralph
Copy link
Copy Markdown
Contributor

@ralph ralph commented Jan 15, 2026

Add add_to_queue to Spirc.

Fixes #1453

Copilot AI review requested due to automatic review settings January 15, 2026 19:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a public API method add_to_queue to the Spirc struct, allowing programmatic addition of tracks to the playback queue. This complements the existing internal queue handling that occurs when receiving AddToQueue commands from the Spotify Connect protocol.

Changes:

  • Added add_to_queue public method to Spirc for adding tracks to the queue via URI
  • Added AddToQueue variant to internal SpircCommand enum
  • Added handle_add_to_queue helper method to process queue additions

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
connect/src/spirc.rs Implements the new add_to_queue public API method, command enum variant, command handler, and internal handler function
CHANGELOG.md Documents the new feature addition in the unreleased section

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@photovoltex photovoltex left a comment

Choose a reason for hiding this comment

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

Nice going. Just a single comment what could be improve on.

Comment thread connect/src/spirc.rs Outdated
Comment thread connect/src/spirc.rs Outdated
In order to reflect what the official apps are offering to the user.
@ralph ralph requested a review from photovoltex January 20, 2026 18:51
@ralph
Copy link
Copy Markdown
Contributor Author

ralph commented Jan 20, 2026

@photovoltex I spontaneously added PlayerCommand::EmitAddedToQueueEvent(track_id) in 996eaaa, which will be fired for each Track URI that is resolved from an Album/Playlist URI that is added via add_to_queue, without having to do the resolution twice. Consuming apps can then add e.g. an Album URI via add_to_queue and receive the list of track URIs that were added to the queue via the EmitAddedToQueueEvent to update the UI (list of queued tracks). LMK what you think. If this is a bad idea or too much for 1 PR, I'll revert.

@photovoltex
Copy link
Copy Markdown
Member

I think the event is misplaced in the player, but then again, so is shuffle, repeat and autoplay as they are all related to the Spirc and not the player. So that should be fine, as this is a different problem in itself.

And I'm fine with adding the event as it doesn't inflate the PR to much and is still in context in my opinion.

Copy link
Copy Markdown
Member

@photovoltex photovoltex left a comment

Choose a reason for hiding this comment

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

Looks good, just update the docs for add_to_queue so that we know which item types are supported from the outside. And remove the two types in handle_add_to_queue, then this should be ready to merge.

Unless you add something again xd

@ralph
Copy link
Copy Markdown
Contributor Author

ralph commented Jan 21, 2026

@photovoltex with docs for add_to_queue you mean the comment above? then it's fixed in 0e125e1. Sorry for missing this! 😬

Missed some more places that were fixed in 5b3aebd.

Copy link
Copy Markdown
Member

@photovoltex photovoltex left a comment

Choose a reason for hiding this comment

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

LGTM, will merge it in the afternoon :)

@photovoltex photovoltex merged commit 87d37c3 into librespot-org:dev Jan 21, 2026
12 checks passed
@photovoltex
Copy link
Copy Markdown
Member

Thanks again for taking on the issue :D

@ralph
Copy link
Copy Markdown
Contributor Author

ralph commented Jan 21, 2026

My pleasure! Thank you for the constructive feedback, help and patience. The rust community feels like a very friendly place. 😀

@ralph ralph deleted the add-to-queue branch January 22, 2026 07:18
iTomKo added a commit to iTomKo/librespot that referenced this pull request Jan 22, 2026
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.

Add add_to_queue method to Spirc

3 participants