Esempio n. 1
0
        protected async Task DownloadArtworkAsync(string title, string artist, string alternateTitle = "", string alternateArtist = "")
        {
            this.IsBusy = true;

            try
            {
                Uri artworkUri = await ArtworkUtils.GetAlbumArtworkFromInternetAsync(title, artist, alternateTitle, alternateArtist);

                string temporaryFile = await this.cacheService.DownloadFileToTemporaryCacheAsync(artworkUri);

                this.UpdateArtwork(ImageUtils.Image2ByteArray(temporaryFile, 0, 0));
            }
            catch (Exception ex)
            {
                LogClient.Error("An error occurred while downloading artwork. Exception: {0}", ex.Message);
            }

            this.IsBusy = false;
        }
Esempio n. 2
0
        protected async Task DownloadArtworkAsync(string title, IList <string> artists, string alternateTitle = "", IList <string> alternateArtists = null)
        {
            this.IsBusy = true;

            try
            {
                string artworkUriString = await ArtworkUtils.GetAlbumArtworkFromInternetAsync(title, artists, alternateTitle, alternateArtists);

                if (!string.IsNullOrEmpty(artworkUriString))
                {
                    string temporaryFile = await this.cacheService.DownloadFileToTemporaryCacheAsync(artworkUriString);

                    this.UpdateArtwork(ImageUtils.Image2ByteArray(temporaryFile, 0, 0));
                }
            }
            catch (Exception ex)
            {
                LogClient.Error("An error occurred while downloading artwork. Exception: {0}", ex.Message);
            }

            this.IsBusy = false;
        }
Esempio n. 3
0
        private async Task <string> GetArtworkFromInternet(string albumTitle, IList <string> albumArtists, string trackTitle, IList <string> artists)
        {
            Uri artworkUri = await ArtworkUtils.GetAlbumArtworkFromInternetAsync(albumTitle, albumArtists, trackTitle, artists);

            return(await this.cacheService.CacheArtworkAsync(artworkUri));
        }
Esempio n. 4
0
        private async Task <string> GetArtworkFromInternet(Album album)
        {
            Uri artworkUri = await ArtworkUtils.GetAlbumArtworkFromInternetAsync(album.AlbumTitle, album.AlbumArtist);

            return(await this.cacheService.CacheArtworkAsync(artworkUri));
        }