private async Task GetAllArtistsLastFM() { //List<string> someArtists = artistList.GetRange(0, 10); await Task.Run(() => LastFM.GetArtistCountries(artistList)); foreach (string artist in LastFM.artistData.Keys) { Console.WriteLine(artist + " comes from " + LastFM.artistData[artist].GetLocation()); } }
//protected async Task Test() //{ // if (artistList == null) { return; } // if (artistList.Count == 0) { return; } // await SequentialScrape(); // this.StateHasChanged(); //} public async Task SequentialScrape() { if (artistList == null) { return; } if (artistList.Count == 0) { return; } artistsLeft = new List <string>(); artistsLeft.AddRange(artistList); Console.WriteLine(artistsLeft.Count + " artists left"); Console.WriteLine("MusicBrainz:"); await Task.Run(() => MusicBrainz.GetArtistCountries(artistInfo)); artistLocationsMusicBrainz = MusicBrainz.artistData; Console.WriteLine(artistLocationsMusicBrainz.Count + " artist origins found on MusicBrainz"); //this.StateHasChanged(); foreach (string k in artistLocationsMusicBrainz.Keys) { artistsLeft.Remove(k); } Console.WriteLine(artistsLeft.Count + " artists left"); if (artistsLeft.Count == 0) { return; } Console.WriteLine("Metal Archives:"); await Task.Run(() => MetalArchives.GetArtistCountries(artistsLeft)); artistLocationsMetalArchives = MetalArchives.artistData; Console.WriteLine(artistLocationsMetalArchives.Count + " artist origins found on Metal Archives"); //this.StateHasChanged(); foreach (string k in artistLocationsMetalArchives.Keys) { artistsLeft.Remove(k); } Console.WriteLine(artistsLeft.Count + " artists left"); if (artistsLeft.Count == 0) { return; } Console.WriteLine("LastFM:"); await Task.Run(() => LastFM.GetArtistCountries(artistsLeft)); artistLocationsLastFM = LastFM.artistData; Console.WriteLine(artistLocationsLastFM.Count + " artist origins found on LastFM"); //this.StateHasChanged(); foreach (string k in artistLocationsLastFM.Keys) { artistsLeft.Remove(k); } Console.WriteLine(artistsLeft.Count + " artists left"); Console.WriteLine("Artists left:"); for (int i = 0; i < artistsLeft.Count; i++) { Console.WriteLine(artistsLeft[i]); } Console.WriteLine("Executing extensive search!"); await GetRemainingArtistAlbums(); }