aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
diff options
context:
space:
mode:
authorErik Rigtorp <erik@rigtorp.se>2020-05-12 14:33:06 -0700
committerErik Rigtorp <erik@rigtorp.se>2020-05-15 18:33:18 -0700
commitf144acdc9614bed64d7f8842356293a94a3b754a (patch)
tree8eba81eff65857068fff78079cccea03a9ece2dd /Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
parentf33876e7e351129ea2296b537b38f9c87fd67b70 (diff)
Use glob patterns to ignore files
Diffstat (limited to 'Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs')
-rw-r--r--Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs47
1 files changed, 3 insertions, 44 deletions
diff --git a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
index bc1398332..218e5a0c6 100644
--- a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
+++ b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
@@ -1,7 +1,5 @@
using System;
using System.IO;
-using System.Linq;
-using System.Text.RegularExpressions;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Resolvers;
@@ -17,32 +15,6 @@ namespace Emby.Server.Implementations.Library
private readonly ILibraryManager _libraryManager;
/// <summary>
- /// Any folder named in this list will be ignored
- /// </summary>
- private static readonly string[] _ignoreFolders =
- {
- "metadata",
- "ps3_update",
- "ps3_vprm",
- "extrafanart",
- "extrathumbs",
- ".actors",
- ".wd_tv",
-
- // Synology
- "@eaDir",
- "eaDir",
- "#recycle",
-
- // Qnap
- "@Recycle",
- ".@__thumb",
- "$RECYCLE.BIN",
- "System Volume Information",
- ".grab",
- };
-
- /// <summary>
/// Initializes a new instance of the <see cref="CoreResolutionIgnoreRule"/> class.
/// </summary>
/// <param name="libraryManager">The library manager.</param>
@@ -60,23 +32,15 @@ namespace Emby.Server.Implementations.Library
return false;
}
- var filename = fileInfo.Name;
-
- // Ignore hidden files on UNIX
- if (Environment.OSVersion.Platform != PlatformID.Win32NT
- && filename[0] == '.')
+ if (IgnorePatterns.ShouldIgnore(fileInfo.FullName))
{
return true;
}
+ var filename = fileInfo.Name;
+
if (fileInfo.IsDirectory)
{
- // Ignore any folders in our list
- if (_ignoreFolders.Contains(filename, StringComparer.OrdinalIgnoreCase))
- {
- return true;
- }
-
if (parent != null)
{
// Ignore trailer folders but allow it at the collection level
@@ -109,11 +73,6 @@ namespace Emby.Server.Implementations.Library
return true;
}
}
-
- // Ignore samples
- Match m = Regex.Match(filename, @"\bsample\b", RegexOptions.IgnoreCase);
-
- return m.Success;
}
return false;