using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; using System.Runtime.Serialization; namespace MediaBrowser.Controller.Entities.Audio { /// /// Class MusicArtist /// public class MusicArtist : Folder, IItemByName, IHasMusicGenres, IHasDualAccess { [IgnoreDataMember] public Dictionary UserItemCounts { get; set; } public bool IsAccessedByName { get; set; } public override bool IsFolder { get { return !IsAccessedByName; } } protected override IEnumerable ActualChildren { get { if (IsAccessedByName) { throw new InvalidOperationException("Artists accessed by name do not have children."); } return base.ActualChildren; } } public override string GetClientTypeName() { if (IsAccessedByName) { //return "Artist"; } return base.GetClientTypeName(); } /// /// Gets or sets the last fm image URL. /// /// The last fm image URL. public string LastFmImageUrl { get; set; } public string LastFmImageSize { get; set; } public MusicArtist() { UserItemCounts = new Dictionary(); } /// /// Gets the user data key. /// /// System.String. public override string GetUserDataKey() { return GetUserDataKey(this); } /// /// Gets the user data key. /// /// The item. /// System.String. public static string GetUserDataKey(BaseItem item) { var id = item.GetProviderId(MetadataProviders.Musicbrainz); if (!string.IsNullOrEmpty(id)) { return "Artist-Musicbrainz-" + id; } return "Artist-" + item.Name; } } }