public async Task Add(Playlist playlist) { if (UnmanagedPlaylistContainer == null) { return; } await SpotifyObject.WaitForInitialization(UnmanagedPlaylistContainer.IsLoaded); UnmanagedPlaylistContainer.AddPlaylist(Link.CreateFromPlaylist(playlist)); }
public override async void LoggedIn(SpotifySession session, SpotifyError error) { if (error == SpotifyError.Ok) { await SpotifyObject.WaitForInitialization(session.User().IsLoaded); _Session.PreferredBitrate(BitRate._320k); } _LoggedInCallback(error); }
public async Task <PlaylistCollection> GetPlaylistCollection() { var container = _Session.Playlistcontainer(); if (container == null) { throw new SpotifyException(SpotifyError.SystemFailure, "Playlist container could not be retrieved from the library"); } await SpotifyObject.WaitForInitialization(container.IsLoaded); return(new PlaylistCollection(container)); }
public async Task Remove(Playlist playlist) { if (UnmanagedPlaylistContainer == null) { return; } await SpotifyObject.WaitForInitialization(UnmanagedPlaylistContainer.IsLoaded); for (int i = 0; i < UnmanagedPlaylistContainer.NumPlaylists(); i++) { var unmanagedPlaylist = UnmanagedPlaylistContainer.Playlist(i); await SpotifyObject.WaitForInitialization(unmanagedPlaylist.IsLoaded); if (unmanagedPlaylist.Name() == playlist.Name()) { UnmanagedPlaylistContainer.RemovePlaylist(i); break; } } }
public async Task <IEnumerable <Playlist> > GetPlaylists() { var playlists = new List <Playlist>(); if (UnmanagedPlaylistContainer == null) { return(playlists); } await SpotifyObject.WaitForInitialization(UnmanagedPlaylistContainer.IsLoaded); for (var i = 0; i < UnmanagedPlaylistContainer.NumPlaylists(); i++) { var unmanagedPlaylist = UnmanagedPlaylistContainer.Playlist(i); if (unmanagedPlaylist == null) { continue; } await SpotifyObject.WaitForInitialization(unmanagedPlaylist.IsLoaded); playlists.Add(unmanagedPlaylist); } return(playlists); }