public static void ProcessArtistData(MusicArtist source, Artist target)
 {
     target.PremiereDate = source.PremiereDate;
     target.ProductionYear = source.ProductionYear;
     target.Tags = source.Tags.ToList();
     target.Overview = source.Overview;
     target.ProductionLocations = source.ProductionLocations.ToList();
 }
Exemple #2
0
        /// <summary>
        /// Finds the music artist.
        /// </summary>
        /// <param name="artist">The artist.</param>
        /// <param name="allMusicArtists">All music artists.</param>
        /// <returns>MusicArtist.</returns>
        public static MusicArtist FindMusicArtist(Artist artist, IEnumerable<MusicArtist> allMusicArtists)
        {
            var musicBrainzId = artist.GetProviderId(MetadataProviders.Musicbrainz);

            return allMusicArtists.FirstOrDefault(i =>
            {
                if (!string.IsNullOrWhiteSpace(musicBrainzId) && string.Equals(musicBrainzId, i.GetProviderId(MetadataProviders.Musicbrainz), StringComparison.OrdinalIgnoreCase))
                {
                    return true;
                }

                return string.Compare(i.Name, artist.Name, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreCase | CompareOptions.IgnoreSymbols) == 0;
            });
        }
Exemple #3
0
 /// <summary>
 /// Finds the music artist.
 /// </summary>
 /// <param name="artist">The artist.</param>
 /// <param name="libraryManager">The library manager.</param>
 /// <returns>MusicArtist.</returns>
 public static MusicArtist FindMusicArtist(Artist artist, ILibraryManager libraryManager)
 {
     return FindMusicArtist(artist, libraryManager.RootFolder.RecursiveChildren.OfType<MusicArtist>());
 }
        /// <summary>
        /// Finds the music artist.
        /// </summary>
        /// <param name="artist">The artist.</param>
        /// <param name="libraryManager">The library manager.</param>
        /// <returns>MusicArtist.</returns>
        private static MusicArtist FindMusicArtist(Artist artist, ILibraryManager libraryManager)
        {
            var musicBrainzId = artist.GetProviderId(MetadataProviders.Musicbrainz);

            return libraryManager.RootFolder.RecursiveChildren
                .OfType<MusicArtist>()
                .FirstOrDefault(i =>
                {
                    if (!string.IsNullOrWhiteSpace(musicBrainzId) && string.Equals(musicBrainzId, i.GetProviderId(MetadataProviders.Musicbrainz), StringComparison.OrdinalIgnoreCase))
                    {
                        return true;
                    }

                    return false;
                });
        }
        /// <summary>
        /// Sets the item counts.
        /// </summary>
        /// <param name="artist">The artist.</param>
        /// <param name="userId">The user id.</param>
        /// <param name="allItems">All items.</param>
        private void SetItemCounts(Artist artist, Guid? userId, IEnumerable<IHasArtist> allItems)
        {
            var name = artist.Name;

            var items = allItems
                .Where(i => i.HasArtist(name))
                .ToList();

            var counts = new ItemByNameCounts
            {
                TotalCount = items.Count,

                SongCount = items.OfType<Audio>().Count(),

                AlbumCount = items.OfType<MusicAlbum>().Count(),

                MusicVideoCount = items.OfType<MusicVideo>().Count()
            };

            if (userId.HasValue)
            {
                artist.UserItemCounts[userId.Value] = counts;
            }
        }
Exemple #6
0
 /// <summary>
 /// Finds the music artist.
 /// </summary>
 /// <param name="artist">The artist.</param>
 /// <param name="libraryManager">The library manager.</param>
 /// <returns>MusicArtist.</returns>
 public static MusicArtist FindMusicArtist(Artist artist, ILibraryManager libraryManager)
 {
     return(FindMusicArtist(artist, libraryManager.RootFolder.RecursiveChildren.OfType <MusicArtist>()));
 }