From a3d4a687aa6f8563ba55d242d8361187f7b2db83 Mon Sep 17 00:00:00 2001 From: Monirzadeh <25131576+Monirzadeh@users.noreply.github.com> Date: Wed, 26 Jun 2024 20:45:13 +0330 Subject: [PATCH] feat: use bookmark thumbnail as ebook cover (#943) * use thumbnail as ebook cover * add TODO for improve that later Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com> --------- Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com> --- internal/core/ebook.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/core/ebook.go b/internal/core/ebook.go index b03e3974..d587f86c 100644 --- a/internal/core/ebook.go +++ b/internal/core/ebook.go @@ -62,6 +62,12 @@ func GenerateEbook(deps *dependencies.Dependencies, req ProcessRequest, dstPath ebook.SetTitle(book.Title) ebook.SetAuthor(book.Author) + if deps.Domains.Storage.FileExists(bookmarkThumbnailPath) { + // TODO: Use `deps.Domains.Storage` to retrieve the file. + absoluteCoverPath := fp.Join(deps.Config.Storage.DataDir, bookmarkThumbnailPath) + coverPath, _ := ebook.AddImage(absoluteCoverPath, "cover.jpg") + ebook.SetCover(coverPath, "") + } ebook.SetDescription(book.Excerpt) _, err = ebook.AddSection(`