コード例 #1
0
        private static void FetchLyrics(Artist artist, IEnumerable <Song> songs)
        {
            Write("");
            Write($"Cool, we're fetching the lyrics for {songs.Count()} songs...");
            Write("");

            // this would be faster multi-threaded, but I don't want to hammer api.lyrics.ovh
            foreach (var song in songs)
            {
                Write($"  '{song.Title}'...");
                var lyricResponse = _musicService.GetLyrics(artist, song).Result;
                Console.SetCursorPosition(0, Console.CursorTop - 1);
                if (lyricResponse.Status == LyricsStatus.Found)
                {
                    Success($"  Lyrics fetched for '{song.Title}'");
                }
                else
                {
                    Error($"  Lyrics could not be fetched for '{song.Title}'");
                }
            }
        }