fix: Update to latest Librespot to fix playback

* fix: adapt to librespot SpotifyUri API changes

Fixes compatibility with librespot PR #1622 which changed the API
from SpotifyId::from_uri() to SpotifyUri::from_uri().

Changes:
- Updated src/spotify_worker.rs to use SpotifyUri instead of SpotifyId
- Updated Cargo.toml to use librespot from official repository
  (merge commit a9122dcb from PR #1622)
- Regenerated Cargo.lock with updated dependencies

Fixes #1732
Depends on librespot-org/librespot#1622 (merged)

* Switch to 0.8.0 release

* Update CHANGELOG

* `cargo fmt`

---------

Co-authored-by: Guilherme Fontes <48162143+gui-baeta@users.noreply.github.com>
Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
This commit is contained in:
Guilherme Fontes
2025-11-11 09:46:15 +00:00
committed by GitHub
parent 56520c2d8d
commit 6d703deac3
4 changed files with 593 additions and 609 deletions

View File

@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Playlist retrieval crashing when list contains podcast episodes - Playlist retrieval crashing when list contains podcast episodes
- Crash when shifting a song by an amount greater than the queue's length - Crash when shifting a song by an amount greater than the queue's length
- Crash when displaying songs that do not have an (available) artist - Crash when displaying songs that do not have an (available) artist
- Playback broken due to Spotify API change
## [1.3.1] ## [1.3.1]

1175
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -52,10 +52,10 @@ fern = "0.7"
futures = "0.3" futures = "0.3"
ioctl-rs = {version = "0.2", optional = true} ioctl-rs = {version = "0.2", optional = true}
libc = "0.2.177" libc = "0.2.177"
librespot-core = "0.7.1" librespot-core = "0.8.0"
librespot-oauth = "0.7.1" librespot-oauth = "0.8.0"
librespot-playback = {version = "0.7.1", default-features = false, features = ["native-tls"]} librespot-playback = {version = "0.8.0", default-features = false, features = ["native-tls"]}
librespot-protocol = "0.7.1" librespot-protocol = "0.8.0"
log = "0.4.28" log = "0.4.28"
pancurses = {version = "0.17.0", optional = true} pancurses = {version = "0.17.0", optional = true}
parse_duration = "2.1.1" parse_duration = "2.1.1"

View File

@@ -3,8 +3,8 @@ use crate::model::playable::Playable;
use crate::queue::QueueEvent; use crate::queue::QueueEvent;
use crate::spotify::PlayerEvent; use crate::spotify::PlayerEvent;
use futures::Future; use futures::Future;
use librespot_core::SpotifyUri;
use librespot_core::session::Session; use librespot_core::session::Session;
use librespot_core::spotify_id::SpotifyId;
use librespot_core::token::Token; use librespot_core::token::Token;
use librespot_playback::mixer::Mixer; use librespot_playback::mixer::Mixer;
use librespot_playback::player::{Player, PlayerEvent as LibrespotPlayerEvent}; use librespot_playback::player::{Player, PlayerEvent as LibrespotPlayerEvent};
@@ -98,14 +98,14 @@ impl Worker {
tokio::select! { tokio::select! {
cmd = self.commands.next() => match cmd { cmd = self.commands.next() => match cmd {
Some(WorkerCommand::Load(playable, start_playing, position_ms)) => { Some(WorkerCommand::Load(playable, start_playing, position_ms)) => {
match SpotifyId::from_uri(&playable.uri()) { match SpotifyUri::from_uri(&playable.uri()) {
Ok(id) => { Ok(uri) => {
info!("player loading track: {id:?}"); info!("player loading track: {uri:?}");
if !id.is_playable() { if !uri.is_playable() {
warn!("track is not playable"); warn!("track is not playable");
self.events.send(Event::Player(PlayerEvent::FinishedTrack)); self.events.send(Event::Player(PlayerEvent::FinishedTrack));
} else { } else {
self.player.load(id, start_playing, position_ms); self.player.load(uri, start_playing, position_ms);
} }
} }
Err(e) => { Err(e) => {
@@ -133,9 +133,9 @@ impl Worker {
self.token_task = Box::pin(Self::get_token(self.session.clone(), sender)); self.token_task = Box::pin(Self::get_token(self.session.clone(), sender));
} }
Some(WorkerCommand::Preload(playable)) => { Some(WorkerCommand::Preload(playable)) => {
if let Ok(id) = SpotifyId::from_uri(&playable.uri()) { if let Ok(uri) = SpotifyUri::from_uri(&playable.uri()) {
debug!("Preloading {id:?}"); debug!("Preloading {uri:?}");
self.player.preload(id); self.player.preload(uri);
} }
} }
Some(WorkerCommand::Shutdown) => { Some(WorkerCommand::Shutdown) => {