< Summary - Jellyfin

Information
Class: Emby.Server.Implementations.Library.IgnorePatterns
Assembly: Emby.Server.Implementations
File(s): /srv/git/jellyfin/Emby.Server.Implementations/Library/IgnorePatterns.cs
Line coverage
100%
Covered lines: 105
Uncovered lines: 0
Coverable lines: 105
Total lines: 136
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 11/7/2025 - 12:11:55 AM Line coverage: 100% (101/101) Branch coverage: 100% (4/4) Total lines: 1321/19/2026 - 12:13:54 AM Line coverage: 100% (102/102) Branch coverage: 100% (4/4) Total lines: 1331/29/2026 - 12:13:32 AM Line coverage: 100% (105/105) Branch coverage: 100% (4/4) Total lines: 136 11/7/2025 - 12:11:55 AM Line coverage: 100% (101/101) Branch coverage: 100% (4/4) Total lines: 1321/19/2026 - 12:13:54 AM Line coverage: 100% (102/102) Branch coverage: 100% (4/4) Total lines: 1331/29/2026 - 12:13:32 AM Line coverage: 100% (105/105) Branch coverage: 100% (4/4) Total lines: 136

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
ShouldIgnore(...)100%44100%

File(s)

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

#LineLine coverage
 1using System;
 2using DotNet.Globbing;
 3
 4namespace Emby.Server.Implementations.Library
 5{
 6    /// <summary>
 7    /// Glob patterns for files to ignore.
 8    /// </summary>
 9    public static class IgnorePatterns
 10    {
 11        /// <summary>
 12        /// Files matching these glob patterns will be ignored.
 13        /// </summary>
 114        private static readonly string[] _patterns =
 115        {
 116            "**/small.jpg",
 117            "**/albumart.jpg",
 118
 119            // We have neither non-greedy matching or character group repetitions, working around that here.
 120            // https://github.com/dazinator/DotNet.Glob#patterns
 121            // .*/sample\..{1,5}
 122            "**/sample.?",
 123            "**/sample.??",
 124            "**/sample.???", // Matches sample.mkv
 125            "**/sample.????", // Matches sample.webm
 126            "**/sample.?????",
 127            "**/*.sample.?",
 128            "**/*.sample.??",
 129            "**/*.sample.???",
 130            "**/*.sample.????",
 131            "**/*.sample.?????",
 132            "**/sample/*",
 133
 134            // Directories
 135            "**/metadata/**",
 136            "**/metadata",
 137            "**/ps3_update/**",
 138            "**/ps3_update",
 139            "**/ps3_vprm/**",
 140            "**/ps3_vprm",
 141            "**/extrafanart/**",
 142            "**/extrafanart",
 143            "**/extrathumbs/**",
 144            "**/extrathumbs",
 145            "**/.actors/**",
 146            "**/.actors",
 147            "**/.wd_tv/**",
 148            "**/.wd_tv",
 149            "**/lost+found/**",
 150            "**/lost+found",
 151            "**/subs/**",
 152            "**/subs",
 153            "**/.snapshots/**",
 154            "**/.snapshots",
 155            "**/.snapshot/**",
 156            "**/.snapshot",
 157
 158            // Trickplay files
 159            "**/*.trickplay",
 160            "**/*.trickplay/**",
 161
 162            // WMC temp recording directories that will constantly be written to
 163            "**/TempRec/**",
 164            "**/TempRec",
 165            "**/TempSBE/**",
 166            "**/TempSBE",
 167
 168            // Synology
 169            "**/eaDir/**",
 170            "**/eaDir",
 171            "**/@eaDir/**",
 172            "**/@eaDir",
 173            "**/#recycle/**",
 174            "**/#recycle",
 175
 176            // Qnap
 177            "**/@Recycle/**",
 178            "**/@Recycle",
 179            "**/.@__thumb/**",
 180            "**/.@__thumb",
 181            "**/$RECYCLE.BIN/**",
 182            "**/$RECYCLE.BIN",
 183            "**/System Volume Information/**",
 184            "**/System Volume Information",
 185            "**/.grab/**",
 186            "**/.grab",
 187
 188            // Unix hidden files
 189            "**/.*",
 190
 191            // Mac - if you ever remove the above.
 192            // "**/._*",
 193            // "**/.DS_Store",
 194
 195            // thumbs.db
 196            "**/thumbs.db",
 197
 198            // bts sync files
 199            "**/*.bts",
 1100            "**/*.sync",
 1101
 1102            // zfs
 1103            "**/.zfs/**",
 1104            "**/.zfs"
 1105        };
 106
 1107        private static readonly GlobOptions _globOptions = new GlobOptions
 1108        {
 1109            Evaluation =
 1110            {
 1111                CaseInsensitive = true
 1112            }
 1113        };
 114
 1115        private static readonly Glob[] _globs = Array.ConvertAll(_patterns, p => Glob.Parse(p, _globOptions));
 116
 117        /// <summary>
 118        /// Returns true if the supplied path should be ignored.
 119        /// </summary>
 120        /// <param name="path">The path to test.</param>
 121        /// <returns>Whether to ignore the path.</returns>
 122        public static bool ShouldIgnore(ReadOnlySpan<char> path)
 123        {
 37124            int len = _globs.Length;
 3694125            for (int i = 0; i < len; i++)
 126            {
 1829127                if (_globs[i].IsMatch(path))
 128                {
 19129                    return true;
 130                }
 131            }
 132
 18133            return false;
 134        }
 135    }
 136}