public List <SpotifyTrack> GetSpotifyTracks(string query)
        {
            List <FullTrack>    FullTrackList = SpotifyApi.SearchTracksByQuery(query, _spotifyAuth);
            List <SpotifyTrack> TrackList     = new List <SpotifyTrack>();

            foreach (FullTrack track in FullTrackList)
            {
                SpotifyTrack NewTrack = new SpotifyTrack
                {
                    Name      = track.Name,
                    SpotifyID = track.Id
                };
                TrackList.Add(NewTrack);
            }
            return(TrackList);
        }
        public List <SpotifyAlbum> GetSpotifyAlbums(SpotifyArtist artistObj)
        {
            List <SimpleAlbum>  SimpleAlbumList = SpotifyApi.SearchAlbums(artistObj, _spotifyAuth);
            List <SpotifyAlbum> AlbumList       = new List <SpotifyAlbum>();

            foreach (SimpleAlbum album in SimpleAlbumList)
            {
                SpotifyAlbum newAlbum = new SpotifyAlbum
                {
                    Name      = album.Name,
                    SpotifyID = album.Id
                };
                AlbumList.Add(newAlbum);
            }
            return(GetUniqueSpotifyAlbums(AlbumList));
        }
        public List <SpotifyArtist> GetSpotifyArtists(string query)
        {
            List <FullArtist>    items      = SpotifyApi.SearchArtists(query, _spotifyAuth);
            List <SpotifyArtist> artistList = new List <SpotifyArtist>();

            foreach (FullArtist artist in items)
            {
                SpotifyArtist newArtist = new SpotifyArtist
                {
                    Name      = artist.Name,
                    SpotifyID = artist.Id
                };
                artistList.Add(newArtist);
            }
            return(artistList);
        }
        public List <SpotifyTrack> GetSpotifyTracks(SpotifyAlbum albumObj)
        {
            List <SimpleTrack>  SimpleTrackList = SpotifyApi.SearchTracks(albumObj, _spotifyAuth);
            List <SpotifyTrack> TrackList       = new List <SpotifyTrack>();

            foreach (SimpleTrack track in SimpleTrackList)
            {
                SpotifyTrack NewTrack = new SpotifyTrack
                {
                    Name      = track.Name,
                    SpotifyID = track.Id,
                    TrackNo   = track.TrackNumber
                };
                TrackList.Add(NewTrack);
            }
            return(TrackList);
        }
        public void AddPlaylistToSpotify(PlaylistObject playlist)
        {
            var trackUris = new List <string>();

            foreach (var guid in playlist.Albums)
            {
                IAlbum album = (IAlbum)GetMusicObject(guid);
                if (album is SpotifyAlbum)
                {
                    List <SpotifyTrack> trackList = GetTracks(album).Cast <SpotifyTrack>().ToList();
                    foreach (var track in trackList)
                    {
                        trackUris.Add(track.SpotifyID);
                    }
                }
            }

            FullPlaylist newPlaylist = SpotifyApi.CreatePlaylist(playlist.Name, _settings.Creds.SpotifyUser, _spotifyAuth);

            SpotifyApi.AddPlaylistTracks(trackUris, newPlaylist, _spotifyAuth);
        }
 public void UpdateSpotifyAuth(Credentials creds)
 {
     _spotifyAuth = SpotifyApi.GetAuthObjByImplicitGrant(creds.SpotifyID).Result;
 }