Enhance extra rules for video and audio file naming; update tests for new naming conventions

This commit is contained in:
Sven Cazier
2025-07-26 23:24:58 +02:00
parent a068f75623
commit 7785b51f57
8 changed files with 195 additions and 93 deletions

View File

@@ -38,7 +38,8 @@ namespace Emby.Server.Implementations.Library
}
// Don't ignore top level folders
if (fileInfo.IsDirectory && parent is AggregateFolder)
if (fileInfo.IsDirectory
&& (parent is AggregateFolder || (parent?.IsTopParent ?? false)))
{
return false;
}
@@ -48,35 +49,21 @@ namespace Emby.Server.Implementations.Library
return true;
}
var filename = fileInfo.Name;
if (parent is null)
{
return false;
}
if (fileInfo.IsDirectory)
{
if (parent is not null)
{
// Ignore extras for unsupported types
if (_namingOptions.AllExtrasTypesFolderNames.ContainsKey(filename)
&& parent is not AggregateFolder
&& parent is not UserRootFolder)
{
return true;
}
}
}
else
{
if (parent is not null)
{
// Don't resolve theme songs
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);
}
}
}