예제 #1
0
 public void AddAlbum(Album album)
 {
     lastAlbumPlayed.Add(album);
 }
예제 #2
0
        public static void GetArtistInfo(Artist artist, dynamic dyn)
        {
            if(artist.albums==null)
            artist.albums = new List<Album>();

            foreach (var data in dyn.items)
            {
                var album = new Album();
                album.title = data.name;
                album.id = data.id;
                album.url = data.external_urls.spotify;
                artist.albums.Add(album);
            }

            string next = dyn.next;
            if (!string.IsNullOrEmpty(next))
                GetArtistInfo(artist, MakeRequest(next));
            else
                ShowAlbums(artist);
        }
예제 #3
0
        public static void ShowSongs(Album album)
        {
            int i = 1;
            Console.ForegroundColor = ConsoleColor.Green;
            foreach (var song in album.songs)
            {
                Console.WriteLine("#" + i + " " + song.title);
                i++;
            }
            Console.WriteLine("#" + i + "Play Album.");
            Console.WriteLine("#0 Exit");
            Console.ResetColor();
            Console.WriteLine("What would you like to do?");
               string answer =  Console.ReadLine();
               int num = 0;
               int.TryParse(answer, out num);

               if (num == 0)
               return;
               else if (num == i)
               {
               System.Diagnostics.Process.Start(album.url);
               history.AddAlbum(album);
               }
               else
               {
               System.Diagnostics.Process.Start(album.songs[num - 1].url);
               history.AddSong(album.songs[num - 1]);
               }
        }
예제 #4
0
        public static void GetAlbumSongs(Album album, dynamic dyn)
        {
            if (album.songs == null)
                album.songs = new List<Song>();

            foreach (var data in dyn.tracks.items)
            {
                var song = new Song();
                song.title = data.name;
                song.id = data.id;
                song.url = data.external_urls.spotify;
                album.songs.Add(song);
            }

            string next = dyn.next;
            if (!string.IsNullOrEmpty(next))
                GetAlbumSongs(album, MakeRequest(next));
            else
                ShowSongs(album);
        }