Beispiel #1
0
        public List <FullTrack> GetSavedTracks()
        {
            var savedTracksPaging = _spotifyApi.Spotify.GetSavedTracks();
            var savedTracks       = _tracksConverter.ToList(savedTracksPaging);

            return(savedTracks);
        }
        public void ToList_SavedTracksPaging_ReturnsCorrectList()
        {
            var savedTracksPaging = GlobalTestInitializer.SpotifyApi.Spotify.GetSavedTracks();

            var savedTracks = _tracksConverter.ToList(savedTracksPaging);

            Assert.AreEqual(savedTracksPaging.Items.Count, savedTracks.Count);
        }
        public bool GetAlbum(string albumId)
        {
            var  album       = _albumsUtils.GetParticularAlbum(albumId);
            var  albumTracks = _tracksConverter.ToList(album.Tracks);
            bool running     = true;

            while (running)
            {
                IO.WriteLine(
                    $"Artist: {album.Artists[0].Name}\nName: {album.Name}\nRelease date: {album.ReleaseDate}");
                var menu = new BasicModelMenu();
                int i    = 1;
                foreach (var playlistTrack in albumTracks)
                {
                    TimeSpan ts = TimeSpan.FromMilliseconds(playlistTrack.DurationMs);
                    menu.AddItem($"{playlistTrack.Name} {ts.Minutes}:{ts.Seconds}",
                                 _trackMenuFunctions.GetTrack, i++.ToString(), playlistTrack.Id);
                }

                menu.AddItem("Save Album", SaveAlbum, i++.ToString(), albumId);
                menu.AddItem("Remove Saved Album", RemoveSavedAlbum, i++.ToString(), albumId);
                menu.AddItem("Exit", _exitFunctions.Exit, i++.ToString(), null);
                running = menu.Display();
            }

            return(true);
        }
        public bool GetPlaylist(string playlistId)
        {
            var  playlist       = _playlistsUtils.GetParticularPlaylist(playlistId);
            var  playlistTracks = _tracksConverter.ToList(playlist.Tracks);
            bool running        = true;

            while (running)
            {
                IO.WriteLine($"Author: {playlist.Owner.DisplayName}\nPlaylist Name: {playlist.Name}");
                var menu = new BasicModelMenu();
                int i    = 1;
                foreach (var playlistTrack in playlistTracks)
                {
                    TimeSpan ts = TimeSpan.FromMilliseconds(playlistTrack.DurationMs);
                    menu.AddItem($"{playlistTrack.Artists[0].Name} - {playlistTrack.Name} {ts.Minutes}:{ts.Seconds}",
                                 _trackMenuFunctions.GetTrack, i++.ToString(), playlistTrack.Id);
                }

                menu.AddItem("Follow Playlist", FollowPlaylist, i++.ToString(), playlistId);
                menu.AddItem("Unfollow Playlist", UnfollowPlaylist, i++.ToString(), playlistId);
                menu.AddItem("Exit", _exitFunctions.Exit, i.ToString(), null);
                running = menu.Display();
            }

            return(true);
        }