21 lines
608 B
C#
21 lines
608 B
C#
using YandexMusic.API.Models.Common.Cover;
|
|
|
|
namespace PlaylistShared.Api.Extensions;
|
|
|
|
public static class YCoverExtensions
|
|
{
|
|
public static string GetUrl(this YCover cover)
|
|
{
|
|
switch (cover)
|
|
{
|
|
case YCoverImage img when !string.IsNullOrEmpty(img.Uri):
|
|
return img.Uri;
|
|
case YCoverPic pic when !string.IsNullOrEmpty(pic.Uri):
|
|
return pic.Uri;
|
|
case YCoverMosaic mosaic when mosaic.ItemsUri.Any():
|
|
return mosaic.ItemsUri.First();
|
|
default:
|
|
return string.Empty;
|
|
}
|
|
}
|
|
} |