Example #1
0
        private async Task <int> AddSongsAsync()
        {
            var count = 0;
            var songs = (await Http.GetFromJsonAsync <ServiceResult <IEnumerable <FMDto> > >($"/fm/random")).Result;

            if (songs != null && songs.Any())
            {
                count = songs.Count();
                var ap = songs.Select(p => new
                {
                    name   = p.AlbumTitle,
                    artist = p.Artist,
                    url    = p.Url,
                    lrc    = p.Lyric,
                    cover  = $"https://images.weserv.nl/?url={p.Picture}"
                }).ToArray();
                await Common.AddAplayerAsync(ap, msg : "换歌?点[趣]");
            }
            return(count);
        }