using MediaBrowser.Common.IO; 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; namespace MediaBrowser.Providers.Music { public class AlbumMetadataService : MetadataService { public AlbumMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager) { } /// /// Merges the specified source. /// /// The source. /// The target. /// The locked fields. /// if set to true [replace data]. /// if set to true [merge metadata settings]. protected override void MergeData(MusicAlbum source, MusicAlbum target, List lockedFields, bool replaceData, bool mergeMetadataSettings) { ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); if (replaceData || target.Artists.Count == 0) { target.Artists = source.Artists; } } protected override async Task BeforeSave(MusicAlbum item, bool isFullRefresh, ItemUpdateType currentUpdateType) { var updateType = await base.BeforeSave(item, isFullRefresh, currentUpdateType).ConfigureAwait(false); if (isFullRefresh || currentUpdateType > ItemUpdateType.None) { if (!item.IsLocked) { var songs = item.RecursiveChildren.OfType