Merge pull request #12039 from Shadowghost/fix-local-episode-thumb

Fix local episode image thumb recognition
This commit is contained in:
Bond-009 2024-06-15 17:37:30 +02:00 committed by GitHub
commit d813f83b4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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