Artist getting progress display

This commit is contained in:
Norbi Peti 2019-07-02 21:26:53 +02:00
parent 75cf86b363
commit fb6246d563
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56

View file

@ -69,6 +69,8 @@ namespace HiddenUpdater
Console.WriteLine(C + " / " + tracks.Total); Console.WriteLine(C + " / " + tracks.Total);
Console.WriteLine("Getting artists..."); Console.WriteLine("Getting artists...");
C = 0;
int max = artistJson.Count;
foreach (var kv in artistJson) foreach (var kv in artistJson)
{ {
var artist = spotify.GetArtist((string) kv.Value["sid"]); var artist = spotify.GetArtist((string) kv.Value["sid"]);
@ -76,8 +78,12 @@ namespace HiddenUpdater
artJson["followers"] = artist?.Followers?.Total; artJson["followers"] = artist?.Followers?.Total;
artJson["popularity"] = artist?.Popularity; artJson["popularity"] = artist?.Popularity;
artJson["genres"] = new JArray(artist?.Genres); artJson["genres"] = new JArray(artist?.Genres);
C++;
if (C % 10 == 0) Console.Write("\r" + C + "/" + max + " - " + (C / (float) max) * 100 + "%");
} }
Console.WriteLine("\r" + C + "/" + max + " - " + (C / (float) max) * 100 + "%");
//Console.WriteLine(artistJson.ToString(Formatting.None)); //Console.WriteLine(artistJson.ToString(Formatting.None));
File.WriteAllText("songs.json", new JArray(playlistJson.OrderBy(song=>song["sid"])).ToString()); File.WriteAllText("songs.json", new JArray(playlistJson.OrderBy(song=>song["sid"])).ToString());
File.WriteAllText("artists.json", new JArray(artistJson.Children().Select(tk=>tk.Last) File.WriteAllText("artists.json", new JArray(artistJson.Children().Select(tk=>tk.Last)