adapt to new rspotify structures
these changes are necessary to handle playlists with local tracks properly
This commit is contained in:
@@ -123,9 +123,13 @@ impl futures::Future for Worker {
|
||||
debug!("message received!");
|
||||
match cmd {
|
||||
WorkerCommand::Load(track) => {
|
||||
let id = SpotifyId::from_base62(&track.id).expect("could not parse id");
|
||||
self.play_task = Box::new(self.player.load(id, false, 0));
|
||||
info!("player loading track: {:?}", track);
|
||||
if let Some(track_id) = &track.id {
|
||||
let id = SpotifyId::from_base62(track_id).expect("could not parse id");
|
||||
self.play_task = Box::new(self.player.load(id, false, 0));
|
||||
info!("player loading track: {:?}", track);
|
||||
} else {
|
||||
self.events.send(Event::Player(PlayerEvent::FinishedTrack));
|
||||
}
|
||||
}
|
||||
WorkerCommand::Play => {
|
||||
self.player.play();
|
||||
@@ -407,7 +411,11 @@ impl Spotify {
|
||||
|
||||
pub fn overwrite_playlist(&self, id: &str, tracks: &[Track]) {
|
||||
// extract only track IDs
|
||||
let mut tracks: Vec<String> = tracks.iter().map(|track| track.id.clone()).collect();
|
||||
let mut tracks: Vec<String> = tracks
|
||||
.iter()
|
||||
.filter(|track| track.id.is_some())
|
||||
.map(|track| track.id.clone().unwrap())
|
||||
.collect();
|
||||
|
||||
// we can only send 100 tracks per request
|
||||
let mut remainder = if tracks.len() > 100 {
|
||||
|
||||
Reference in New Issue
Block a user