/// <summary> /// Helper method to retrieve a stream with an album cover image /// </summary> public WebStreamModel GetAlbumCover(String cover, Int32 albumId, AlbumCoverSize size) { var w = 750; var h = 750; if (!RestUtility.ParseImageSize(size.ToString(), out w, out h)) throw new ArgumentException("Invalid image size", "size"); String url = null; if (!String.IsNullOrEmpty(cover)) url = String.Format("http://resources.wimpmusic.com/images/{0}/{1}x{2}.jpg", cover.Replace('-', '/'), w, h); else url = String.Format("http://images.tidalhifi.com/im/im?w={1}&h={2}&albumid={0}&noph", albumId, w, h); return new WebStreamModel(RestClient.GetWebResponse(url)); }
/// <summary> /// Helper method to retrieve a stream with an album cover image /// </summary> public Stream GetAlbumCover(String cover, Int32 albumId, AlbumCoverSize size) { var w = 750; var h = 750; if (!RestUtility.ParseImageSize(size.ToString(), out w, out h)) { throw new ArgumentException("Invalid image size", "size"); } String url = null; if (!String.IsNullOrEmpty(cover)) { url = String.Format("http://resources.wimpmusic.com/images/{0}/{1}x{2}.jpg", cover.Replace('-', '/'), w, h); } else { url = String.Format("http://images.tidalhifi.com/im/im?w={1}&h={2}&albumid={0}&noph", albumId, w, h); } return(RestClient.GetStream(url)); }
public static string GetAlbumCoverUrl(String cover, Int32 albumId, AlbumCoverSize size) { int w = 750; int h = 750; if (!RestUtility.ParseImageSize(size.ToString(), out w, out h)) { throw new ArgumentException("Invalid image size", "size"); } String url = null; if (!String.IsNullOrEmpty(cover)) { url = GetImageUrl(cover, w, h); } else { url = String.Format("http://images.tidalhifi.com/im/im?w={1}&h={2}&albumid={0}&noph", albumId, w, h); } return(url); }
/// <summary> /// Helper method to retrieve a stream with an album cover image /// </summary> public Task <WebStreamModel> GetAlbumCoverAsync(String cover, Int32 albumId, AlbumCoverSize size) { string url = GetAlbumCoverUrl(cover, albumId, size); return(RestClient.GetWebStreamModelAsync(url)); }
/// <summary> /// Helper method to retrieve a stream with an album cover image /// </summary> public Task <WebStreamModel> GetAlbumCoverAsync(AlbumModel model, AlbumCoverSize size) { return(GetAlbumCoverAsync(model.Cover, model.Id, size)); }
/// <summary> /// Helper method to retrieve a stream with an album cover image /// </summary> public Stream GetAlbumCover(AlbumModel model, AlbumCoverSize size) { return(GetAlbumCover(model.Cover, model.Id, size)); }
/// <summary> /// Helper method to retrieve a stream with an album cover image /// </summary> public WebStreamModel GetAlbumCover(AlbumModel model, AlbumCoverSize size) { return GetAlbumCover(model.Cover, model.Id, size); }