示例#1
0
        public override PlayableBase ToPlayable()
        {
            var result   = (SongResult)Result;
            var newtrack = new AnyListenTrack
            {
                SongResult = result,
                TimeAdded  = DateTime.Now,
                IsChecked  = false,
                Artist     = result.ArtistName,
                Album      = result.AlbumName,
                Duration   = CommonHelper.NumToTime(result.Length),
                WebTrack   = result
            };

            newtrack.LoadInformation();
            return(newtrack);
        }
示例#2
0
        public static async Task <BitmapImage> LoadBitmapImage(AnyListenTrack track, DirectoryInfo albumDirectory)
        {
            var config = AnyListenSettings.Instance.Config;

            using (var client = new WebClient {
                Proxy = null
            })
            {
                var image = await ImageHelper.DownloadImage(client, track.SongResult.PicUrl);

                if (config.SaveCoverLocal)
                {
                    if (!albumDirectory.Exists)
                    {
                        albumDirectory.Create();
                    }
                    await ImageHelper.SaveImage(image, track.SongResult.Type + "_" + (string.IsNullOrEmpty(track.SongResult.AlbumId) ? track.SongResult.SongId : track.SongResult.AlbumId), albumDirectory.FullName);
                }
                return(image);
            }
        }