Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        public void AddItemToBasicModelMenu_BasicModelMenuItemsCountIncremented()
        {
            var menu = new BasicModelMenu();

            menu.AddItem(null, (a) => true, null, null);
            Assert.AreEqual(1, menu.items.Count);
        }
Esempio n. 4
0
        public bool GetTrack(string trackId)
        {
            var  track   = _tracksUtils.GetParticularTrack(trackId);
            bool running = true;

            while (running)
            {
                IO.WriteLine($"Author: {track.Artists[0].Name}\nTrack Name: {track.Name}");
                var menu = new BasicModelMenu();
                menu.AddItem("Save Track", SaveTrack, "1", track.Id);
                menu.AddItem("Remove Track From Saved", RemoveSavedTrack, "2", track.Id);
                menu.AddItem("Exit", _exitFunctions.Exit, "3", null);
                running = menu.Display();
            }

            return(true);
        }
Esempio n. 5
0
        public bool GetRelatedArtists(string artistId)
        {
            var relatedArtists = _artistsUtils.GetRelatedArtists(artistId);
            var artistsMenu    = new BasicModelMenu();
            int i = 1;

            relatedArtists.ForEach(artist =>
                                   artistsMenu.AddItem(artist.Name, GetArtist, i++.ToString(), artist.Id));
            artistsMenu.AddItem("Exit", _exitFunctions.Exit, i.ToString(), null);
            bool running = true;

            while (running)
            {
                running = artistsMenu.Display();
            }

            return(true);
        }
Esempio n. 6
0
        public bool GetArtist(string artistId)
        {
            var artist = _artistsUtils.GetParticularArtist(artistId);

            var artistMenu = new BasicModelMenu();

            artistMenu.AddItem($"Related Artists", GetRelatedArtists, "1", artistId);
            artistMenu.AddItem($"Artist's Top Tracks", GetArtistTopTracks, "2", artistId);
            artistMenu.AddItem($"Artist's Albums", GetArtistsAlbums, "3", artistId);
            artistMenu.AddItem($"Follow Artist", FollowArtist, "4", artistId);
            artistMenu.AddItem($"UnfollowArtist", UnfollowArtist, "5", artistId);
            artistMenu.AddItem($"Exit", _exitFunctions.Exit, "6", null);
            bool running = true;

            while (running)
            {
                IO.WriteLine(
                    $"Artist: {artist.Name}\nFollowers: {artist.Followers.Total}\nPopularity: {artist.Popularity}");
                running = artistMenu.Display();
            }

            return(true);
        }