public void OnCurrentSongChanged(object sender, CurrentSongEventArgs args)
 {
     Task.Run(() =>
     {
         try
         {
             WebRequest request          = GetRequest(string.Format(lyricsUrl, args.NewSong.Title, args.NewSong.Artist));
             WebResponse response        = request.GetResponse();
             StreamReader responseStream = new StreamReader(response.GetResponseStream(), encode);
             JObject json = JObject.Parse(responseStream.ReadToEnd());
             if ((string)json["message"]["header"]["status_code"] == "401")
             {
                 SetLyrics("Unathorized call to Lyrics API, please check \"apikey\" parameter in the plugin config file."
                           + "Current value: \"" + ApiKey + "\"");
             }
             else
             {
                 SetLyrics((string)json["message"]["body"]["lyrics"]["lyrics_body"]);
             }
         }
         catch (ArgumentException)
         {
             SetLyrics("Lyrics not found");
         }
     });
 }
Exemple #2
0
 public void OnCurrentSongChanged(object sender, CurrentSongEventArgs args)
 {
     Task.Run(async() =>
     {
         try
         {
             var response = await GetResponse(string.Format(lyricsUrl, args.NewSong.Title, args.NewSong.Artist)).ConfigureAwait(false);
             JObject json = JObject.Parse(response);
             if ((string)json["message"]["header"]["status_code"] == "401")
             {
                 SetLyrics("Unathorized call to Lyrics API, please check \"apikey\" parameter in the plugin config file."
                           + "Current value: \"" + ApiKey + "\"");
             }
             else
             {
                 SetLyrics((string)json["message"]["body"]["lyrics"]["lyrics_body"]);
             }
         }
         catch (ArgumentException)
         {
             SetLyrics("Lyrics not found");
         }
     });
 }
Exemple #3
0
 public void OnCurrentSongChanged(object sender, CurrentSongEventArgs args)
 {
     // Do nothing
 }
 public void OnCurrentSongChanged(object sender, CurrentSongEventArgs args)
 {
     SetSong(args.NewSong.Title, args.NewSong.Artist);
 }