public void AddAlbum(Album album) { lastAlbumPlayed.Add(album); }
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); }
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]); } }
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); }