< Summary - Jellyfin

Information
Class: MediaBrowser.Providers.BoxSets.BoxSetMetadataService
Assembly: MediaBrowser.Providers
File(s): /srv/git/jellyfin/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs
Line coverage
9%
Covered lines: 2
Uncovered lines: 20
Coverable lines: 22
Total lines: 85
Line coverage: 9%
Branch coverage
0%
Covered branches: 0
Total branches: 10
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

File(s)

/srv/git/jellyfin/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs

#LineLine coverage
 1#pragma warning disable CS1591
 2
 3using System.Collections.Generic;
 4using System.Linq;
 5using MediaBrowser.Controller.Configuration;
 6using MediaBrowser.Controller.Entities;
 7using MediaBrowser.Controller.Entities.Movies;
 8using MediaBrowser.Controller.Library;
 9using MediaBrowser.Controller.Providers;
 10using MediaBrowser.Model.Entities;
 11using MediaBrowser.Model.IO;
 12using MediaBrowser.Providers.Manager;
 13using Microsoft.Extensions.Logging;
 14
 15namespace MediaBrowser.Providers.BoxSets
 16{
 17    public class BoxSetMetadataService : MetadataService<BoxSet, BoxSetInfo>
 18    {
 19        public BoxSetMetadataService(
 20            IServerConfigurationManager serverConfigurationManager,
 21            ILogger<BoxSetMetadataService> logger,
 22            IProviderManager providerManager,
 23            IFileSystem fileSystem,
 24            ILibraryManager libraryManager)
 2125            : base(serverConfigurationManager, logger, providerManager, fileSystem, libraryManager)
 26        {
 2127        }
 28
 29        /// <inheritdoc />
 030        protected override bool EnableUpdatingGenresFromChildren => true;
 31
 32        /// <inheritdoc />
 033        protected override bool EnableUpdatingOfficialRatingFromChildren => true;
 34
 35        /// <inheritdoc />
 036        protected override bool EnableUpdatingStudiosFromChildren => true;
 37
 38        /// <inheritdoc />
 039        protected override bool EnableUpdatingPremiereDateFromChildren => true;
 40
 41        /// <inheritdoc />
 42        protected override IReadOnlyList<BaseItem> GetChildrenForMetadataUpdates(BoxSet item)
 43        {
 044            return item.GetLinkedChildren();
 45        }
 46
 47        /// <inheritdoc />
 48        protected override void MergeData(MetadataResult<BoxSet> source, MetadataResult<BoxSet> target, MetadataField[] 
 49        {
 050            base.MergeData(source, target, lockedFields, replaceData, mergeMetadataSettings);
 51
 052            var sourceItem = source.Item;
 053            var targetItem = target.Item;
 54
 055            if (mergeMetadataSettings)
 56            {
 057                if (replaceData || targetItem.LinkedChildren.Length == 0)
 58                {
 059                    targetItem.LinkedChildren = sourceItem.LinkedChildren;
 60                }
 61                else
 62                {
 063                    targetItem.LinkedChildren = sourceItem.LinkedChildren.Concat(targetItem.LinkedChildren).Distinct().T
 64                }
 65            }
 066        }
 67
 68        /// <inheritdoc />
 69        protected override ItemUpdateType BeforeSaveInternal(BoxSet item, bool isFullRefresh, ItemUpdateType updateType)
 70        {
 071            var updatedType = base.BeforeSaveInternal(item, isFullRefresh, updateType);
 72
 073            var libraryFolderIds = item.GetLibraryFolderIds();
 74
 075            var itemLibraryFolderIds = item.LibraryFolderIds;
 076            if (itemLibraryFolderIds is null || !libraryFolderIds.SequenceEqual(itemLibraryFolderIds))
 77            {
 078                item.LibraryFolderIds = libraryFolderIds;
 079                updatedType |= ItemUpdateType.MetadataImport;
 80            }
 81
 082            return updatedType;
 83        }
 84    }
 85}