using System.Collections.Generic; using System.Linq; using Newtonsoft.Json; namespace ZonyLrcTools.Cli.Infrastructure.Lyric.NetEase.JsonModel { public class SongSearchResponse { [JsonProperty("result")] public InnerListItemModel Items { get; set; } [JsonProperty("code")] public int StatusCode { get; set; } public int GetFirstMatchSongId(string songName) { var item = Items.SongItems.FirstOrDefault(x => x.Name == songName); return item?.Id ?? Items.SongItems[0].Id; } } public class InnerListItemModel { [JsonProperty("songs")] public IList SongItems { get; set; } [JsonProperty("songCount")] public int SongCount { get; set; } } public class SongModel { /// /// 歌曲的名称。 /// [JsonProperty("name")] public string Name { get; set; } /// /// 歌曲的 Sid (Song Id)。 /// [JsonProperty("id")] public int Id { get; set; } /// /// 歌曲的演唱者。 /// [JsonProperty("artists")] public IList Artists { get; set; } /// /// 歌曲的专辑信息。 /// [JsonProperty("album")] public SongAlbumModel Album { get; set; } } public class SongArtistModel { /// /// 歌手/艺术家的名称。 /// [JsonProperty("name")] public string Name { get; set; } } public class SongAlbumModel { /// /// 专辑的名称。 /// [JsonProperty("name")] public string Name { get; set; } /// /// 专辑图像的 Url 地址。 /// [JsonProperty("img1v1Url")] public string PictureUrl { get; set; } } }