From dd6bf594f0bc47fc4de9a96c571475a653e48ddc Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Mon, 5 Oct 2026 12:05:00 +0300 Subject: [PATCH] Returns the artwork of a Calibre book as a list of artwork references, instead of a single one --- .../Core/CalibreArtworkProvider.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/Lumina.Plugins.Calibre/Core/CalibreArtworkProvider.cs b/plugins/Lumina.Plugins.Calibre/Core/CalibreArtworkProvider.cs index e3ffd5e3..557bf102 100644 --- a/plugins/Lumina.Plugins.Calibre/Core/CalibreArtworkProvider.cs +++ b/plugins/Lumina.Plugins.Calibre/Core/CalibreArtworkProvider.cs @@ -38,30 +38,30 @@ internal sealed class CalibreArtworkProvider : IArtworkProvider /// The lookup describing the book to get the cover for. /// Cancellation token that can be used to stop the execution. - /// The cover of the book, or when no cover was found. - public Task GetArtworkAsync(BookMetadataLookupDto lookup, CancellationToken cancellationToken) + /// The cover of the book, or an empty collection when no cover was found. + public Task> GetArtworkAsync(BookMetadataLookupDto lookup, CancellationToken cancellationToken) { if (string.IsNullOrWhiteSpace(lookup.Path)) - return Task.FromResult(null); + return Task.FromResult>([]); string bookDirectory = Path.GetDirectoryName(lookup.Path) ?? string.Empty; string opfFilePath = Path.Combine(bookDirectory, "metadata.opf"); if (!File.Exists(opfFilePath)) - return Task.FromResult(null); + return Task.FromResult>([]); OpfDocumentDto document = OpfReader.Read(opfFilePath); if (string.IsNullOrWhiteSpace(document.CoverHref)) - return Task.FromResult(null); + return Task.FromResult>([]); // the cover reference must be a bare file name contained in the directory of the book, so that no file outside of it can be accessed string coverFileName = Path.GetFileName(document.CoverHref); if (coverFileName != document.CoverHref || Path.IsPathRooted(document.CoverHref)) - return Task.FromResult(null); + return Task.FromResult>([]); string coverFilePath = Path.Combine(bookDirectory, coverFileName); if (!File.Exists(coverFilePath)) - return Task.FromResult(null); + return Task.FromResult>([]); - return Task.FromResult(new ArtworkDto(LocalPath: coverFilePath, RemoteUrl: null)); + return Task.FromResult>([new ArtworkDto(ArtworkType.Cover, Ordinal: 0, LocalPath: coverFilePath, RemoteUrl: null)]); } }