From 053e2bef388554b9c87dba320fc700288243919f Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Thu, 18 Aug 2016 16:20:41 -0400 Subject: [PATCH] Fix #101 incorrect track titles with Spotify Now iterates over all the search returns and makes sure that the window title contains the song/artist before using it as the current song. --- Snip/Players/Spotify.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Snip/Players/Spotify.cs b/Snip/Players/Spotify.cs index ab392bf..e87e908 100644 --- a/Snip/Players/Spotify.cs +++ b/Snip/Players/Spotify.cs @@ -83,14 +83,19 @@ public override void Update() { jsonSummary = SimpleJson.DeserializeObject(jsonSummary.tracks["items"].ToString()); - TextHandler.UpdateText( - jsonSummary[0].name.ToString(), - jsonSummary[0].artists[0].name.ToString(), - jsonSummary[0].album.name.ToString()); - - if (Globals.SaveAlbumArtwork) + foreach (dynamic song in jsonSummary) { - this.HandleSpotifyAlbumArtwork(jsonSummary[0].name.ToString()); + if (spotifyTitle.Contains(song.name) && spotifyTitle.Contains(song.artists[0].name)) + { + TextHandler.UpdateText(song.name.ToString(), song.artists[0].name.ToString(), song.album.name.ToString()); + + if (Globals.SaveAlbumArtwork) + { + this.HandleSpotifyAlbumArtwork(song.name.ToString()); + } + + break; + } } } else