Skip to content

feat: Initiate transfer playback via spclient api#1530

Merged
roderickvd merged 7 commits into
librespot-org:devfrom
photovoltex:feat/transfer
Nov 7, 2025
Merged

feat: Initiate transfer playback via spclient api#1530
roderickvd merged 7 commits into
librespot-org:devfrom
photovoltex:feat/transfer

Conversation

@photovoltex

Copy link
Copy Markdown
Member
  • adds a method to invoke the transfer endpoint of spclient
  • adds a method to spirc to easily transfer the playback to ourselves
  • prevent commands of spirc to be executed before connection establishment

During checkups at the end I also encountered a warning for big-num, which might be a problem sometimes in the future.

For context I did run `cargo report future-incompatibilities --id 1` after cargo suggested it: The following warnings were discovered during the build. These warnings are an indication that the packages contain code that will become an error in a future release of Rust. These warnings typically cover changes to close soundness problems, unintended or undocumented behavior, or critical problems that cannot be fixed in a backwards-compatible fashion, and are not expected to be in wide use.

Each warning should contain a link for more information on what the warning
means and how to resolve it.

To solve this problem, you can try the following approaches:

  • If the issue is not solved by updating the dependencies, a fix has to be
    implemented by those dependencies. You can help with that by notifying the
    maintainers of this problem (e.g. by creating a bug report) or by proposing a
    fix to the maintainers (e.g. by creating a pull request):

  • If waiting for an upstream fix is not an option, you can use the [patch]
    section in Cargo.toml to use your own version of the dependency. For more
    information, see:
    https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section

The package num-bigint-dig v0.8.4 currently triggers the following future incompatibility lints:

warning: macro vec is private
--> /home/photovoltex/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-bigint-dig-0.8.4/src/biguint.rs:490:22
|
490 | BigUint::new(vec![1])
| ^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #120192 rust-lang/rust#120192

warning: macro vec is private
--> /home/photovoltex/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-bigint-dig-0.8.4/src/biguint.rs:2005:9
|
2005 | vec![0]
| ^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #120192 rust-lang/rust#120192

warning: macro vec is private
--> /home/photovoltex/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-bigint-dig-0.8.4/src/biguint.rs:2027:16
|
2027 | return vec![b'0'];
| ^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #120192 rust-lang/rust#120192

warning: macro vec is private
--> /home/photovoltex/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-bigint-dig-0.8.4/src/biguint.rs:2313:13
|
2313 | vec![0]
| ^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #120192 rust-lang/rust#120192

warning: macro vec is private
--> /home/photovoltex/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-bigint-dig-0.8.4/src/prime.rs:138:22
|
138 | let mut moduli = vec![BigUint::zero(); prime_limit];
| ^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #120192 rust-lang/rust#120192

warning: macro vec is private
--> /home/photovoltex/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-bigint-dig-0.8.4/src/bigrand.rs:319:25
|
319 | let mut bytes = vec![0u8; bytes_len];
| ^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #120192 rust-lang/rust#120192

Resolves #1519

Copilot AI review requested due to automatic review settings August 9, 2025 19:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 implements functionality to transfer Spotify playback control to the current device using the spclient transfer API. It adds methods to initiate playback transfers and ensures commands are only executed after connection establishment.

  • Adds a transfer method to SpClient that calls the Connect transfer endpoint
  • Adds a transfer method to Spirc for convenient playback transfer to the current device
  • Prevents spirc commands from executing before connection is established

Reviewed Changes

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

File Description
core/src/spclient.rs Implements transfer method to call spclient transfer API endpoint
core/src/dealer/protocol/request.rs Updates TransferOptions to use Option<String> fields and adds serialization support
connect/src/spirc.rs Adds connection state tracking, Transfer command, and prevents command execution before connection
CHANGELOG.md Documents the new transfer method addition

Comment thread core/src/spclient.rs Outdated
Comment thread core/src/spclient.rs Outdated
Comment thread core/src/spclient.rs Outdated
Comment thread connect/src/spirc.rs Outdated
Comment thread connect/src/spirc.rs Outdated
@roderickvd

Copy link
Copy Markdown
Member

You want to include this into the any-day-to-be-released-now v0.7.0 or wait until after?

@photovoltex

Copy link
Copy Markdown
Member Author

Let's wait with merging this. I think it's a nice addition but not necessary to get the release out.

And btw. thanks for the opinionated work the last days. That made some decisions that were standing out for a while finally resolved :D

@roderickvd roderickvd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Few small questions.

Comment thread core/src/dealer/protocol/request.rs
Comment thread connect/src/spirc.rs Outdated
Comment thread core/src/spclient.rs Outdated

@roderickvd roderickvd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@roderickvd roderickvd merged commit 57a5fbb into librespot-org:dev Nov 7, 2025
12 checks passed
@photovoltex photovoltex deleted the feat/transfer branch November 14, 2025 20:33
CreatorMetaSky pushed a commit to StreamMediaSpace/librespot-zig that referenced this pull request Feb 9, 2026
* feat: provide an easy transfer option to the spirc
* fix: execute spirc commands after connection establishment
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 option to transfer playback to librespot

3 participants