< Summary - Jellyfin

Information
Class: Emby.Server.Implementations.Library.CoreResolutionIgnoreRule
Assembly: Emby.Server.Implementations
File(s): /srv/git/jellyfin/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
Line coverage
100%
Covered lines: 17
Uncovered lines: 0
Coverable lines: 17
Total lines: 69
Line coverage: 100%
Branch coverage
95%
Covered branches: 19
Total branches: 20
Branch coverage: 95%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
ShouldIgnore(...)95%2020100%

File(s)

/srv/git/jellyfin/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs

#LineLine coverage
 1using System;
 2using System.IO;
 3using Emby.Naming.Audio;
 4using Emby.Naming.Common;
 5using MediaBrowser.Controller;
 6using MediaBrowser.Controller.Entities;
 7using MediaBrowser.Controller.Resolvers;
 8using MediaBrowser.Model.IO;
 9
 10namespace Emby.Server.Implementations.Library
 11{
 12    /// <summary>
 13    /// Provides the core resolver ignore rules.
 14    /// </summary>
 15    public class CoreResolutionIgnoreRule : IResolverIgnoreRule
 16    {
 17        private readonly NamingOptions _namingOptions;
 18        private readonly IServerApplicationPaths _serverApplicationPaths;
 19
 20        /// <summary>
 21        /// Initializes a new instance of the <see cref="CoreResolutionIgnoreRule"/> class.
 22        /// </summary>
 23        /// <param name="namingOptions">The naming options.</param>
 24        /// <param name="serverApplicationPaths">The server application paths.</param>
 25        public CoreResolutionIgnoreRule(NamingOptions namingOptions, IServerApplicationPaths serverApplicationPaths)
 26        {
 2627            _namingOptions = namingOptions;
 2628            _serverApplicationPaths = serverApplicationPaths;
 2629        }
 30
 31        /// <inheritdoc />
 32        public bool ShouldIgnore(FileSystemMetadata fileInfo, BaseItem? parent)
 33        {
 34            // Don't ignore application folders
 10535            if (fileInfo.FullName.Contains(_serverApplicationPaths.RootFolderPath, StringComparison.InvariantCulture))
 36            {
 9437                return false;
 38            }
 39
 40            // Don't ignore top level folders
 1141            if (fileInfo.IsDirectory
 1142                && (parent is AggregateFolder || (parent?.IsTopParent ?? false)))
 43            {
 344                return false;
 45            }
 46
 847            if (IgnorePatterns.ShouldIgnore(fileInfo.FullName))
 48            {
 149                return true;
 50            }
 51
 752            if (parent is null)
 53            {
 154                return false;
 55            }
 56
 657            if (fileInfo.IsDirectory)
 58            {
 59                // Ignore extras for unsupported types
 360                return _namingOptions.AllExtrasTypesFolderNames.ContainsKey(fileInfo.Name)
 361                    && parent is not UserRootFolder;
 62            }
 63
 64            // Don't resolve theme songs
 365            return Path.GetFileNameWithoutExtension(fileInfo.Name.AsSpan()).Equals(BaseItem.ThemeSongFileName, StringCom
 366                && AudioFileParser.IsAudioFile(fileInfo.Name, _namingOptions);
 67        }
 68    }
 69}