Implement following playlists

This commit is contained in:
KoffeinFlummi
2019-04-19 23:50:36 +02:00
parent e68ba60179
commit f320b953d6
3 changed files with 62 additions and 13 deletions

View File

@@ -10,6 +10,7 @@ use traits::ListItem;
pub struct Playlist {
pub id: String,
pub name: String,
pub owner_id: String,
pub snapshot_id: String,
pub tracks: Vec<Track>,
}
@@ -55,7 +56,11 @@ impl ListItem for Playlist {
}
}
fn toggle_saved(&mut self, _library: Arc<Library>) {
// TODO
fn toggle_saved(&mut self, library: Arc<Library>) {
if library.is_saved_playlist(self) {
library.delete_playlist(&self.id);
} else {
library.follow_playlist(self);
}
}
}