Backport pull request #12039 from jellyfin/release-10.9.z

Fix local episode image thumb recognition

Original-merge: d813f83b4a

Merged-by: Bond-009 <bond.009@outlook.com>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
Shadowghost 2024-06-23 11:40:47 -04:00 committed by Joshua M. Boniface
parent 529d24ec30
commit 970c95959a

View File

@ -40,13 +40,12 @@ namespace MediaBrowser.LocalMetadata.Images
var parentPathFiles = directoryService.GetFiles(parentPath);
var nameWithoutExtension = Path.GetFileNameWithoutExtension(item.Path.AsSpan()).ToString();
var thumbName = string.Concat(nameWithoutExtension, "-thumb");
var images = GetImageFilesFromFolder(thumbName, parentPathFiles);
var images = GetImageFilesFromFolder(nameWithoutExtension, parentPathFiles);
var metadataSubPath = directoryService.GetDirectories(parentPath).Where(d => d.Name.EndsWith("metadata", StringComparison.OrdinalIgnoreCase)).ToList();
foreach (var path in metadataSubPath)
var metadataSubDir = directoryService.GetDirectories(parentPath).FirstOrDefault(d => d.Name.Equals("metadata", StringComparison.Ordinal));
if (metadataSubDir is not null)
{
var files = directoryService.GetFiles(path.FullName);
var files = directoryService.GetFiles(metadataSubDir.FullName);
images.AddRange(GetImageFilesFromFolder(nameWithoutExtension, files));
}
@ -55,9 +54,8 @@ namespace MediaBrowser.LocalMetadata.Images
private List<LocalImageInfo> GetImageFilesFromFolder(ReadOnlySpan<char> filenameWithoutExtension, List<FileSystemMetadata> filePaths)
{
var thumbName = string.Concat(filenameWithoutExtension, "-thumb");
var list = new List<LocalImageInfo>(1);
var thumbName = string.Concat(filenameWithoutExtension, "-thumb");
foreach (var i in filePaths)
{