Skip to content

Commit

Permalink
feat: use bookmark thumbnail as ebook cover (#943)
Browse files Browse the repository at this point in the history
* use thumbnail as ebook cover

* add TODO for improve that later

Co-authored-by: Felipe Martin <[email protected]>

---------

Co-authored-by: Felipe Martin <[email protected]>
  • Loading branch information
Monirzadeh and fmartingr authored Jun 26, 2024
1 parent 06efb08 commit a3d4a68
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/core/ebook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a3d4a68

Please sign in to comment.