Implement browsing for albums, artists, playlists

This commit is contained in:
KoffeinFlummi
2019-04-23 01:40:00 +02:00
parent d750e5a46f
commit eed218d0c3
15 changed files with 449 additions and 46 deletions

View File

@@ -37,6 +37,7 @@ use std::sync::RwLock;
use std::thread;
use std::time::{Duration, SystemTime};
use artist::Artist;
use config;
use events::{Event, EventManager};
use track::Track;
@@ -571,6 +572,16 @@ impl Spotify {
self.api_with_retry(|api| api.user_playlist_follow_playlist(&owner_id, &id, true))
}
pub fn artist_top_tracks(&self, id: String) -> Option<Vec<Track>> {
self.api_with_retry(|api| api.artist_top_tracks(&id, None))
.map(|ft| ft.tracks.iter().map(|t| t.into()).collect())
}
pub fn artist_related_artists(&self, id: String) -> Option<Vec<Artist>> {
self.api_with_retry(|api| api.artist_related_artists(&id))
.map(|fa| fa.artists.iter().map(|a| a.into()).collect())
}
pub fn load(&self, track: &Track) {
info!("loading track: {:?}", track);
self.channel