private async void TryFillLyrics(TrackInfo track, TrackMediaMetadata meta)
 {
     if (string.IsNullOrEmpty(meta.Lyrics) && EnvironmentHelper.HasInternetConnection(!_metadataConfiguration.UpdateLyricsEvenByteBasis))
         await TryFillFromMoeAtHome(track, meta);
     if (string.IsNullOrEmpty(meta.Lyrics) && EnvironmentHelper.HasInternetConnection(!_metadataConfiguration.UpdateLyricsEvenByteBasis))
         await TryFillFromGeciMe(track, meta);
 }
 private async Task TryLoadLyricsFromLocal(TrackInfo track, TrackMediaMetadata meta)
 {
     if (_localLyricsService != null)
     {
         var file = await _localLyricsService.TryGetLocalLyrics(track);
         if (file != null)
         {
             try
             {
                 meta.Lyrics = await FileIO.ReadTextAsync(file);
             }
             catch { }
         }
     }
 }
 private async Task TryLoadCoverFromCache(TrackInfo track, TrackMediaMetadata meta)
 {
     var stream = await _albumCoverCache.TryGetCache(track.Album, track.Artist);
     if (stream != null)
         meta.Cover = await MediaHelper.CreateImage(stream);
 }
 private async Task TryLoadLyricsFromCache(TrackInfo track, TrackMediaMetadata meta)
 {
     var text = await _lyricsCache.TryGetCache(track.Title, track.Artist);
     if (!string.IsNullOrEmpty(text))
         meta.Lyrics = text;
 }
 private async Task TryFillFromMoeAtHome(TrackInfo track, TrackMediaMetadata meta)
 {
     try
     {
         var uri = await _moeAtHome.GetLyrics(track.Title, track.Artist);
         if (uri != null)
             meta.Lyrics = await _lyricsCache.Download(track.Title, track.Artist, uri);
     }
     catch { }
 }
 private async Task TryFillFromLastFm(TrackInfo track, TrackMediaMetadata meta)
 {
     try
     {
         var uri = await GetCoverUriFromLastFm(track.Artist, track.Album);
         if (uri == null)
         {
             var trackResp = await _lastfm.Track.GetInfoAsync(track.Title ?? string.Empty, track.Artist ?? string.Empty);
             if (trackResp.Success)
                 uri = await GetCoverUriFromLastFm(trackResp.Content.ArtistName, trackResp.Content.AlbumName);
         }
         if (uri != null)
         {
             var stream = await _albumCoverCache.Download(track.Album, track.Artist, uri);
             if (stream != null)
                 meta.Cover = await MediaHelper.CreateImage(stream);
         }
     }
     catch { }
 }
 private async Task TryFillFromTrack(TrackInfo track, TrackMediaMetadata meta)
 {
     try
     {
         var uri = track.Source;
         StorageFile file;
         if (uri.Scheme == "ms-appx")
             file = await StorageFile.GetFileFromApplicationUriAsync(uri);
         else if (uri.IsFile)
             file = await StorageFile.GetFileFromPathAsync(uri.LocalPath);
         else
             throw new NotSupportedException("not supported uri.");
         var provider = await MediaMetadataProvider.CreateFromStream(await file.OpenReadAsync(), uri.ToString(), false);
         var cover = provider.Pictures.FirstOrDefault(o => o.PictureType.Contains("Cover"));
         if (cover == null)
             cover = provider.Pictures.FirstOrDefault();
         if (cover != null)
         {
             var stream = new MemoryStream(cover.Data);
             meta.Cover = await MediaHelper.CreateImage(stream.AsRandomAccessStream());
         }
         if (string.IsNullOrEmpty(meta.Lyrics))
             meta.Lyrics = provider.Lyrics;
     }
     catch { }
 }