Beispiel #1
0
        public void SearchForArtistTopSongs(String artistID)
        {
            String url        = @"https://api.spotify.com/v1/artists/" + artistID + "/top-tracks?country=SE";
            String jsonstring = ConnToSpotApi(url);

            //var topSongs = TopSong.FromJson(jsonstring);
            QuickType.RootObject topSong = new QuickType.RootObject();

            try
            {
                topSong = JsonConvert.DeserializeObject <QuickType.RootObject>(jsonstring);
                foreach (Track gen in topSong.tracks)
                {
                    if (gen.album.name.Contains("ö"))
                    {
                        gen.album.name.Replace("ö", "o");
                    }
                    LblArtistTopSongs.Text += gen.name + "<br />";
                    LblArtistAlbums.Text   += gen.album.name + ", ";
                    displayingDiv.Visible   = true;
                }
                //|| gen.album.name.Contains("å") || gen.album.name.Contains("ä")
            }
            catch (Exception e) {
                Label9.Text           = "Artist not found";
                displayingDiv.Visible = false;
            }
        }
Beispiel #2
0
 public static string ToJson(this RootObject self) => JsonConvert.SerializeObject(self, QuickType.Converter.Settings);