Handle unplayable track at start of playlist

This commit is contained in:
ashthespy 2020-05-27 16:24:21 +02:00
parent 01813cf7c9
commit 1da80ce480

View file

@ -910,13 +910,17 @@ impl SpircTask {
| SpircPlayStatus::Stopped => (),
}
}
// Mark unavailable tracks so we can skip them later
fn handle_unavailable(&mut self, track_id: SpotifyId) {
let unavailables = self.get_track_index_for_spotify_id(
&track_id,
self.state.get_playing_track_index() as usize,
);
let playing_index = self.state.get_playing_track_index() as usize;
let search_from = if playing_index == self.state.get_track().len() - 1 {
trace!("Cycling back to 0 instead of {:?}", playing_index);
0
} else {
playing_index
};
let unavailables = self.get_track_index_for_spotify_id(&track_id, search_from);
for &index in unavailables.iter() {
debug_assert_eq!(self.state.get_track()[index].get_gid(), track_id.to_raw());
let mut unplayable_track_ref = TrackRef::new();