add methods and api usage to delete track from playlist (#211)
* wip: add methods and api usage to delete track from playlist * enh: add ability to remove track from playlist with immediate visual feedback * minor cosmetic changes Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
This commit is contained in:
@@ -51,6 +51,16 @@ impl Playlist {
|
||||
|
||||
self.tracks = Some(collected_tracks);
|
||||
}
|
||||
|
||||
pub fn delete_tracks(&mut self, track_pos_pairs: &[(Track, usize)], spotify: Arc<Spotify>) {
|
||||
if spotify.delete_tracks(&self.id, track_pos_pairs) {
|
||||
if let Some(tracks) = &mut self.tracks {
|
||||
for (_track, pos) in track_pos_pairs {
|
||||
tracks.remove(*pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&SimplifiedPlaylist> for Playlist {
|
||||
|
||||
Reference in New Issue
Block a user