Fix: Play multiples of Track and Playable
With the migration to rspotify 0.11.x playlists were changed to be a list of `Playable` instead of `Track` items, so that playlists can contain podcast episodes. This needs to be considered when collecting all tracks for playback in `ListView`. Should help with #667
This commit is contained in:
@@ -113,12 +113,14 @@ impl<I: ListItem> ListView<I> {
|
||||
fn attempt_play_all_tracks(&self) -> bool {
|
||||
let content = self.content.read().unwrap();
|
||||
let any = &(*content) as &dyn std::any::Any;
|
||||
if let Some(tracks) = any.downcast_ref::<Vec<Track>>() {
|
||||
let tracks: Vec<Playable> = tracks
|
||||
.iter()
|
||||
.map(|track| Playable::Track(track.clone()))
|
||||
.collect();
|
||||
let index = self.queue.append_next(&tracks);
|
||||
let playables = any.downcast_ref::<Vec<Playable>>();
|
||||
let tracks = any.downcast_ref::<Vec<Track>>().map(|t| {
|
||||
t.iter()
|
||||
.map(|t| Playable::Track(t.clone()))
|
||||
.collect::<Vec<Playable>>()
|
||||
});
|
||||
if let Some(tracks) = playables.or_else(|| tracks.as_ref()) {
|
||||
let index = self.queue.append_next(tracks);
|
||||
self.queue.play(index + self.selected, true, false);
|
||||
true
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user