public static async Task <int> DictionarySongsByArtistAsync(string artistName) { var url = "http://musicbrainz.org/ws/2/release-group/?query=artist:%22" + artistName + "%22%20AND%20primarytype:%22single%22"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.UserAgent = "Hello World Super Script"; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); var doc = XDocument.Load(response.GetResponseStream()); XNamespace ns = "http://musicbrainz.org/ns/mmd-2.0#"; var titleList = doc.Descendants(ns + "title"); //releaseTitles = x.Element(ns + "release-list").Descendants(ns + "title").Select(y => (string)y).ToArray() //Get song list from the albumns var i = 1; ColourMagic.OhLookColorMagic("al"); var totalLyricLength = 0; var vMax = 0; var vMin = 0; LoopSongTitles(artistName, titleList, ref i, ref totalLyricLength, ref vMax, ref vMin); var result = await DisplayCompleted(artistName, i, totalLyricLength, vMax, vMin); // i = result.Item1; return(result.Item2); }
private async static Task <(int, int)> DisplayCompleted(string artistName, int i, int totalLyricLength, int vMax, int vMin) { await Task.Run(() => { //TODO ensure this runs after the songs list! ColourMagic.OhLookColorMagic("blah"); Console.WriteLine(artistName); if (i != 0) { Console.WriteLine("Sum total of " + totalLyricLength + " words"); Console.WriteLine("Smallest number of words " + vMin); Console.WriteLine("Largest number of words " + vMax); Console.WriteLine("Total singles " + artistName + ": " + i); Console.WriteLine("Average word, per single, for " + artistName + ": " + (totalLyricLength / i)); } else { Console.WriteLine("No lyrics found for" + artistName); } //Maybe a DB would just be easier usually! That or save into a session etc... }); return(i, totalLyricLength / i); }
internal static string PhoenixIcon() { ColourMagic.OhLookColorMagic("phoenix"); var phoenix = ""; phoenix += @" .\\ //." + Environment.NewLine; phoenix += @" . \ \ / /." + Environment.NewLine; phoenix += @" .\ ,\ /` /,.-" + Environment.NewLine; phoenix += @" -. \ /'/ / ." + Environment.NewLine; phoenix += @" ` - `-' \ -" + Environment.NewLine; phoenix += @" '. /.\`" + Environment.NewLine; phoenix += @" - .-" + Environment.NewLine; phoenix += @" :`//.'" + Environment.NewLine; phoenix += @" .`.'" + Environment.NewLine; phoenix += @" .' " + Environment.NewLine; return(phoenix); }