fix: don't try to play tracks without spotify id
Can happen when a playlist is queued that contains tracks removed from the Spotify catalogue. fixes #321
This commit is contained in:
@@ -4,7 +4,7 @@ use librespot_core::config::SessionConfig;
|
|||||||
use librespot_core::keymaster::Token;
|
use librespot_core::keymaster::Token;
|
||||||
use librespot_core::mercury::MercuryError;
|
use librespot_core::mercury::MercuryError;
|
||||||
use librespot_core::session::Session;
|
use librespot_core::session::Session;
|
||||||
use librespot_core::spotify_id::SpotifyId;
|
use librespot_core::spotify_id::{SpotifyAudioType, SpotifyId};
|
||||||
use librespot_playback::config::PlayerConfig;
|
use librespot_playback::config::PlayerConfig;
|
||||||
|
|
||||||
use librespot_playback::audio_backend;
|
use librespot_playback::audio_backend;
|
||||||
@@ -162,8 +162,13 @@ impl futures::Future for Worker {
|
|||||||
match cmd {
|
match cmd {
|
||||||
WorkerCommand::Load(playable) => match SpotifyId::from_uri(&playable.uri()) {
|
WorkerCommand::Load(playable) => match SpotifyId::from_uri(&playable.uri()) {
|
||||||
Ok(id) => {
|
Ok(id) => {
|
||||||
self.player.load(id, true, 0);
|
info!("player loading track: {:?}", id);
|
||||||
info!("player loading track: {:?}", playable);
|
if id.audio_type == SpotifyAudioType::NonPlayable {
|
||||||
|
warn!("track is not playable");
|
||||||
|
self.events.send(Event::Player(PlayerEvent::FinishedTrack));
|
||||||
|
} else {
|
||||||
|
self.player.load(id, true, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("error parsing uri: {:?}", e);
|
error!("error parsing uri: {:?}", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user