Skip to content

Re-Add ability to handle/play tracks #1468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 4, 2025

Conversation

photovoltex
Copy link
Member

Re-Adds the ability that was removed by the dealer rework to handle/play tracks.

Fixes #1097 (as the uris field via the play api will be supported again)

Copy link
Contributor

@Copilot 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 pull request re-adds track handling/play capabilities that were previously removed, restoring support for the uris field in the play API. The changes span multiple modules, updating context conversion, play command handling, load request models, and context resetting logic.

  • Updated protocol conversions for context pages and tracks.
  • Modified SpircTask to support play commands with both URI and tracks.
  • Refactored load request models and context reset behaviors.

Reviewed Changes

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

Show a summary per file
File Description
protocol/src/impl_trait/context.rs Added From implementations for Vec and Vec for ContextPage.
connect/src/spirc.rs Updated play command handling to support PlayContext with URI or tracks and adjusted context resolution logic.
connect/src/model.rs Switched LoadRequest to use the new PlayContext enum and added a helper for track URIs.
connect/src/state/restrictions.rs Modified the restrictions clearing mechanism to assign default values.
connect/src/state/context.rs Updated context reset logic to clear context_uri and context_url, along with minor refactorings.
Comments suppressed due to low confidence (2)

connect/src/spirc.rs:1100

  • When 'load_from_context_uri' is true, the resolve context is added twice (once conditionally and again unconditionally). Consider removing one of the duplicate calls to avoid potential redundant context resolution.
self.context_resolver.add(ResolveContext::from_uri(ctx_uri.clone(), &fallback, ContextType::Default, ContextAction::Replace,));

connect/src/model.rs:23

  • [nitpick] The variant 'Tracks' in PlayContext may be ambiguous. Consider renaming it to 'TrackUris' for improved clarity.
pub(super) enum PlayContext {

Copy link
Member

@roderickvd roderickvd left a comment

Choose a reason for hiding this comment

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

Cool. A couple of code suggestions.

@photovoltex photovoltex requested a review from roderickvd March 23, 2025 13:51
roderickvd
roderickvd previously approved these changes Apr 4, 2025
@photovoltex
Copy link
Member Author

@roderickvd Friendly bump to check over the last changes?

@photovoltex
Copy link
Member Author

Just looked through the changes again and didn't find a changelog entry. I think the reasoning behind that was because the requesting was changed completely, and that is already stated in the changelog. As this just adds something new to the mentioned struct in the changelog no entry is required.

just here for clarification

@photovoltex photovoltex merged commit 8b72954 into librespot-org:dev May 4, 2025
13 checks passed
@photovoltex photovoltex deleted the re-add-play-tracks branch May 4, 2025 18:30
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.

First song is played twice when it should only be played once.
2 participants