19 lines
586 B
C#
19 lines
586 B
C#
using YandexMusic.API.Models.Common.Cover;
|
|
|
|
namespace PlaylistShared.Api.Extensions;
|
|
|
|
public static class YCoverExtensions
|
|
{
|
|
public static string GetUrl(this YCover cover, string size = "200x200")
|
|
{
|
|
switch (cover)
|
|
{
|
|
case YCoverImage img when !string.IsNullOrEmpty(img.Uri):
|
|
return $"https://{img.Uri.Replace("%%", size)}";
|
|
case YCoverPic pic when !string.IsNullOrEmpty(pic.Uri):
|
|
return $"https://{pic.Uri.Replace("%%", size)}";
|
|
default:
|
|
return string.Empty;
|
|
}
|
|
}
|
|
} |