Exemple #1
0
 private ArtistMetadata ConvertMetadata(ArtistSummary artist)
 {
     return(new ArtistMetadata
     {
         Mbid = artist.Id,
         Name = artist.Name
     });
 }
Exemple #2
0
        public async Task Update(string path)
        {
            string artistId = await FindArtistId(path);

            ArtistSummary metadata = await _metadataUpdater.GetArtistMetadata(artistId);

            ArtistMetadata artistMetadata = ConvertMetadata(metadata);

            await Save(path, artistMetadata);
            await UpdateImage(path, artistId);
        }
Exemple #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);
        }
 private ArtistMetadata ConvertMetadata(ArtistSummary artist)
 {
     return new ArtistMetadata
     {
         Mbid = artist.Id,
         Name = artist.Name
     };
 }