From be4ae2baaf5f1932ccb6ca940fc2d5f134d01d6c Mon Sep 17 00:00:00 2001 From: Jimmy Appelt Date: Fri, 2 Oct 2015 21:02:52 +0200 Subject: [PATCH 1/3] Track Length check to confirm video ad is playing --- SpotifyAPI/Local/Models/Track.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/SpotifyAPI/Local/Models/Track.cs b/SpotifyAPI/Local/Models/Track.cs index e8451d32..96eecbcf 100644 --- a/SpotifyAPI/Local/Models/Track.cs +++ b/SpotifyAPI/Local/Models/Track.cs @@ -24,10 +24,14 @@ namespace SpotifyAPI.Local.Models /// /// Checks if the track is an advert /// - /// true if the track is an advert, fals otherwise + /// true if the track is an advert, false otherwise public bool IsAd() { - return TrackType == "ad"; + if (TrackType == "ad") + return true; + if (Length == 0) + return true; + return false; } /// @@ -54,7 +58,7 @@ namespace SpotifyAPI.Local.Models break; } String raw; - using(WebClient wc = new WebClient()) + using (WebClient wc = new WebClient()) { wc.Proxy = null; raw = wc.DownloadString("http://open.spotify.com/album/" + AlbumResource.Uri.Split(new[] { ":" }, StringSplitOptions.None)[2]); @@ -98,7 +102,7 @@ namespace SpotifyAPI.Local.Models /// A Bitmap, which is the albumart public Bitmap GetAlbumArt(AlbumArtSize size) { - using(WebClient wc = new WebClient()) + using (WebClient wc = new WebClient()) { wc.Proxy = null; String url = GetAlbumArtUrl(size); @@ -112,6 +116,6 @@ namespace SpotifyAPI.Local.Models } } } - - + + } From 69d2d708c5725ab205a7d25e5e903a172225f6e9 Mon Sep 17 00:00:00 2001 From: Jimmy Appelt Date: Fri, 2 Oct 2015 21:10:44 +0200 Subject: [PATCH 2/3] Removed - blank lines --- SpotifyAPI/Local/Models/Track.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/SpotifyAPI/Local/Models/Track.cs b/SpotifyAPI/Local/Models/Track.cs index 96eecbcf..7d0c38c1 100644 --- a/SpotifyAPI/Local/Models/Track.cs +++ b/SpotifyAPI/Local/Models/Track.cs @@ -116,6 +116,4 @@ namespace SpotifyAPI.Local.Models } } } - - } From 14b94aebb5eba2837b504a8adfbffd9b1471aad8 Mon Sep 17 00:00:00 2001 From: Jimmy Appelt Date: Sat, 3 Oct 2015 16:16:07 +0200 Subject: [PATCH 3/3] Fix crash when playing form related artist tab --- SpotifyAPI/Local/Models/Track.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpotifyAPI/Local/Models/Track.cs b/SpotifyAPI/Local/Models/Track.cs index 7d0c38c1..cda2dc3e 100644 --- a/SpotifyAPI/Local/Models/Track.cs +++ b/SpotifyAPI/Local/Models/Track.cs @@ -41,7 +41,7 @@ namespace SpotifyAPI.Local.Models /// A String, which is the URL to the Albumart public String GetAlbumArtUrl(AlbumArtSize size) { - if (AlbumResource.Uri == null || AlbumResource.Uri.Contains("local") || AlbumResource.Uri.Contains("spotify:album:0000000000000000000000")) + if (AlbumResource.Uri == null || !AlbumResource.Uri.Contains("spotify:album:") || AlbumResource.Uri.Contains("spotify:album:0000000000000000000000")) return ""; int albumsize = 0;