private static string FindArtistName(string path, ArtistMetadata artistMetadata)
 {
     if (string.IsNullOrEmpty(artistMetadata.Name))
     {
         return MusicHelper.FindArtistNameFromFolder(path);
     }
     return artistMetadata.Name;
 }
 private async Task<string> FindIdFromArtistName(string path, ArtistMetadata artistMetadata)
 {
     string artistName = FindArtistName(path, artistMetadata);
     for (int page = 0; page < int.MaxValue; page++)
     {
         PagedList<ArtistSummary> artists = await _metadataUpdater.FindArtists(artistName, page, MusicHelper.DefaultPageSize);
         ArtistSummary artistSummary = artists.FirstOrDefault();
         if (artistSummary != null)
         {
             return artistSummary.Id;
         }
         if (!artists.HasMoreResults)
         {
             break;
         }
     }
     throw new ArtistNotFoundException("Couldn't find artist for path: " + path);
 }
Пример #3
0
        private async Task <string> FindIdFromArtistName(string path, ArtistMetadata artistMetadata)
        {
            string artistName = FindArtistName(path, artistMetadata);

            for (int page = 0; page < int.MaxValue; page++)
            {
                PagedList <ArtistSummary> artists = await _metadataUpdater.FindArtists(artistName, page, MusicHelper.DefaultPageSize);

                ArtistSummary artistSummary = artists.FirstOrDefault();
                if (artistSummary != null)
                {
                    return(artistSummary.Id);
                }
                if (!artists.HasMoreResults)
                {
                    break;
                }
            }
            throw new ArtistNotFoundException("Couldn't find artist for path: " + path);
        }
 public async Task Save(string path, ArtistMetadata metadata)
 {
     await _metadataRepository.Save(path, metadata);
 }
Пример #5
0
 public async Task Save(string path, ArtistMetadata metadata)
 {
     await _metadataRepository.Save(path, metadata);
 }