using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Providers.Manager; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using MediaBrowser.Controller.IO; using MediaBrowser.Model.IO; using MediaBrowser.Controller.Entities; namespace MediaBrowser.Providers.Music { public class AlbumMetadataService : MetadataService { protected override IList GetChildrenForMetadataUpdates(MusicAlbum item) { return item.GetRecursiveChildren(i => i is Audio) .ToList(); } protected override ItemUpdateType UpdateMetadataFromChildren(MusicAlbum item, IList children, bool isFullRefresh, ItemUpdateType currentUpdateType) { var updateType = base.UpdateMetadataFromChildren(item, children, isFullRefresh, currentUpdateType); if (isFullRefresh || currentUpdateType > ItemUpdateType.None) { if (!item.LockedFields.Contains(MetadataFields.Name)) { var name = children.Select(i => i.Album).FirstOrDefault(i => !string.IsNullOrEmpty(i)); if (!string.IsNullOrEmpty(name)) { if (!string.Equals(item.Name, name, StringComparison.Ordinal)) { item.Name = name; updateType = updateType | ItemUpdateType.MetadataEdit; } } } var songs = children.Cast