feat: Add Book Ingestion Modal for local EPUB metadata extraction (fixes #33)

This commit is contained in:
2026-05-10 20:00:14 +02:00
parent f433e3c74a
commit a6a5fc683c
8 changed files with 399 additions and 1 deletions
@@ -35,4 +35,19 @@ public class WasmEpubService : IEpubService
return Result.Fail(new Error($"Network or parsing error: {ex.Message}").CausedBy(ex));
}
}
public async Task<Result<LocalEpubMetadata>> ExtractMetadataAsync(Stream epubStream)
{
try
{
using var bookRef = await VersOne.Epub.EpubReader.OpenBookAsync(epubStream);
var title = bookRef.Title ?? "Unknown Title";
var author = bookRef.Author ?? "Unknown Author";
byte[]? cover = await bookRef.ReadCoverAsync();
return Result.Ok(new LocalEpubMetadata(title, author, cover));
}
catch (Exception ex)
{
return Result.Fail(new Error($"Failed to extract EPUB metadata locally: {ex.Message}").CausedBy(ex));
}
}
}