Track Length check to confirm video ad is playing

This commit is contained in:
Jimmy Appelt 2015-10-02 21:02:52 +02:00
parent 006f085c4b
commit be4ae2baaf

View File

@ -24,10 +24,14 @@ namespace SpotifyAPI.Local.Models
/// <summary> /// <summary>
/// Checks if the track is an advert /// Checks if the track is an advert
/// </summary> /// </summary>
/// <returns>true if the track is an advert, fals otherwise</returns> /// <returns>true if the track is an advert, false otherwise</returns>
public bool IsAd() public bool IsAd()
{ {
return TrackType == "ad"; if (TrackType == "ad")
return true;
if (Length == 0)
return true;
return false;
} }
/// <summary> /// <summary>
@ -54,7 +58,7 @@ namespace SpotifyAPI.Local.Models
break; break;
} }
String raw; String raw;
using(WebClient wc = new WebClient()) using (WebClient wc = new WebClient())
{ {
wc.Proxy = null; wc.Proxy = null;
raw = wc.DownloadString("http://open.spotify.com/album/" + AlbumResource.Uri.Split(new[] { ":" }, StringSplitOptions.None)[2]); raw = wc.DownloadString("http://open.spotify.com/album/" + AlbumResource.Uri.Split(new[] { ":" }, StringSplitOptions.None)[2]);
@ -98,7 +102,7 @@ namespace SpotifyAPI.Local.Models
/// <returns>A Bitmap, which is the albumart</returns> /// <returns>A Bitmap, which is the albumart</returns>
public Bitmap GetAlbumArt(AlbumArtSize size) public Bitmap GetAlbumArt(AlbumArtSize size)
{ {
using(WebClient wc = new WebClient()) using (WebClient wc = new WebClient())
{ {
wc.Proxy = null; wc.Proxy = null;
String url = GetAlbumArtUrl(size); String url = GetAlbumArtUrl(size);