Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected async void userAddToPlaylist_Click(object sender, EventArgs e)
        {
            // get the user you just logged in with
            SpotifyWebAPI.User user = await SpotifyWebAPI.User.GetCurrentUserProfile(this.AuthenticationToken);

            // get all the playlists
            SpotifyWebAPI.Page <Playlist> playlists = await user.GetPlaylists(this.AuthenticationToken);

            // get the first playlist in the list
            // yes i know this is redundant but i am testing the method GetPlaylist()
            SpotifyWebAPI.Playlist playlist = await SpotifyWebAPI.Playlist.GetPlaylist(user, playlists.Items.FirstOrDefault().Id, this.AuthenticationToken);

            // get alter bridge's blackbird album tracks
            var tracks = await SpotifyWebAPI.Album.GetAlbumTracks("0Fk4lWAADmFMmuW6jp6xyE");

            // add the tracks to the playlist
            await playlist.AddTracks(tracks.Items, this.AuthenticationToken);
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected async void userGetPlaylist_Click(object sender, EventArgs e)
        {
            // get the user you just logged in with
            SpotifyWebAPI.User user = await SpotifyWebAPI.User.GetCurrentUserProfile(this.AuthenticationToken);

            // get all the playlists
            SpotifyWebAPI.Page <Playlist> playlists = await user.GetPlaylists(this.AuthenticationToken);

            // get the first playlist in the list
            // yes i know this is redundant but i am testing the method GetPlaylist()
            SpotifyWebAPI.Playlist playlist = await SpotifyWebAPI.Playlist.GetPlaylist(user, playlists.Items.FirstOrDefault().Id, this.AuthenticationToken);

            output.Text += VarDump.Dump(playlist, 0);

            // get the tracks
            // not by using GetPlaylist() in the previous command you already get the tracks, i'm just doing more testing here.
            SpotifyWebAPI.Page <PlaylistTrack> tracks = await playlist.GetPlaylistTracks(this.AuthenticationToken);

            output.Text += VarDump.Dump(tracks, 0);
        }