aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs')
-rw-r--r--Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs43
1 files changed, 15 insertions, 28 deletions
diff --git a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
index b01fd93a7..ca0744a17 100644
--- a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
+++ b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
@@ -37,46 +37,33 @@ namespace Emby.Server.Implementations.Library
return false;
}
+ if (IgnorePatterns.ShouldIgnore(fileInfo.FullName))
+ {
+ return true;
+ }
+
// Don't ignore top level folders
- if (fileInfo.IsDirectory && parent is AggregateFolder)
+ if (fileInfo.IsDirectory
+ && (parent is AggregateFolder || (parent?.IsTopParent ?? false)))
{
return false;
}
- if (IgnorePatterns.ShouldIgnore(fileInfo.FullName))
+ if (parent is null)
{
- return true;
+ return false;
}
- var filename = fileInfo.Name;
-
if (fileInfo.IsDirectory)
{
- if (parent is not null)
- {
- // Ignore extras folders but allow it at the collection level
- if (_namingOptions.AllExtrasTypesFolderNames.ContainsKey(filename)
- && parent is not AggregateFolder
- && parent is not UserRootFolder)
- {
- return true;
- }
- }
- }
- else
- {
- if (parent is not null)
- {
- // Don't resolve these into audio files
- if (Path.GetFileNameWithoutExtension(filename.AsSpan()).Equals(BaseItem.ThemeSongFileName, StringComparison.Ordinal)
- && AudioFileParser.IsAudioFile(filename, _namingOptions))
- {
- return true;
- }
- }
+ // Ignore extras for unsupported types
+ return _namingOptions.AllExtrasTypesFolderNames.ContainsKey(fileInfo.Name)
+ && parent is not UserRootFolder;
}
- return false;
+ // Don't resolve theme songs
+ return Path.GetFileNameWithoutExtension(fileInfo.Name.AsSpan()).Equals(BaseItem.ThemeSongFileName, StringComparison.Ordinal)
+ && AudioFileParser.IsAudioFile(fileInfo.Name, _namingOptions);
}
}
}