mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 22:56:25 +00:00
Added two methods issue #47
This commit is contained in:
parent
f09c52a60c
commit
200648676f
@ -75,6 +75,7 @@ namespace SpotifyAPI.Local.Models
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a Bitmap of the album cover in the provided size asynchronous
|
||||
/// </summary>
|
||||
@ -95,6 +96,24 @@ namespace SpotifyAPI.Local.Models
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a byte[] of the the album cover in the provided size asynchronous
|
||||
/// </summary>
|
||||
/// <param name="size">AlbumArtSize (160,320,640)</param>
|
||||
/// <returns>A byte[], which is the albumart in binary data</returns>
|
||||
public async Task<byte[]> GetAlbumArtAsByteArrayAsync(AlbumArtSize size)
|
||||
{
|
||||
using (WebClient wc = new WebClient())
|
||||
{
|
||||
wc.Proxy = null;
|
||||
String url = GetAlbumArtUrl(size);
|
||||
if (url == "")
|
||||
return null;
|
||||
return await wc.DownloadDataTaskAsync(url);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a Bitmap of the album cover in the provided size
|
||||
/// </summary>
|
||||
@ -115,5 +134,22 @@ namespace SpotifyAPI.Local.Models
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a byte[] of the album cover in the provided size
|
||||
/// </summary>
|
||||
/// <param name="size">AlbumArtSize (160,320,640)</param>
|
||||
/// <returns>A byte[], which is the albumart in binary data</returns>
|
||||
public byte[] GetAlbumArtAsByteArray(AlbumArtSize size)
|
||||
{
|
||||
using (WebClient wc = new WebClient())
|
||||
{
|
||||
wc.Proxy = null;
|
||||
String url = GetAlbumArtUrl(size);
|
||||
if (url == "")
|
||||
return null;
|
||||
return wc.DownloadData(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user