semi undo

This commit is contained in:
cvium 2021-12-13 00:26:54 +01:00
parent c5569c701c
commit 3a4e7fb075

View File

@ -106,7 +106,7 @@ namespace MediaBrowser.LocalMetadata.Images
{ {
if (!item.IsFileProtocol) if (!item.IsFileProtocol)
{ {
yield break; return Enumerable.Empty<FileSystemMetadata>();
} }
var path = item.ContainingFolderPath; var path = item.ContainingFolderPath;
@ -114,21 +114,14 @@ namespace MediaBrowser.LocalMetadata.Images
// Exit if the cache dir does not exist, alternative solution is to create it, but that's a lot of empty dirs... // Exit if the cache dir does not exist, alternative solution is to create it, but that's a lot of empty dirs...
if (!Directory.Exists(path)) if (!Directory.Exists(path))
{ {
yield break; return Enumerable.Empty<FileSystemMetadata>();
} }
var files = directoryService.GetFileSystemEntries(path).OrderBy(i => Array.IndexOf(BaseItem.SupportedImageExtensions, i.Extension ?? string.Empty)); return directoryService.GetFiles(path)
var count = BaseItem.SupportedImageExtensions.Length; .Where(i =>
foreach (var file in files) (includeDirectories && i.IsDirectory)
{ || Array.FindIndex(BaseItem.SupportedImageExtensions, ext => string.Equals(ext, i.Extension, StringComparison.OrdinalIgnoreCase)) != -1)
for (var i = 0; i < count; i++) .OrderBy(i => Array.IndexOf(BaseItem.SupportedImageExtensions, i.Extension ?? string.Empty));
{
if ((includeDirectories && file.IsDirectory) || string.Equals(BaseItem.SupportedImageExtensions[i], file.Extension, StringComparison.OrdinalIgnoreCase))
{
yield return file;
}
}
}
} }
/// <inheritdoc /> /// <inheritdoc />