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>
This commit is contained in:
Monirzadeh 2024-06-26 20:45:13 +03:30 committed by GitHub
parent 06efb08d01
commit a3d4a687aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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(`<h1 style="text-align:center"> `+book.Title+` </h1>`+book.HTML+lastline, book.Title, "", "")
if err != nil {