duydl / logseq-calibre-annotation

Other
20 stars 2 forks source link

The default ulr of the macro renderer recognizes only epub and uncompatible with other formats #4

Closed Plexprofile closed 8 months ago

Plexprofile commented 8 months ago

I tried importing a pdf file in logseq using the calibre plugin but an error message popped up saying: Could not open Book id #6. The EPUB format is not available. I checked the macro renderer and found out the ulr was displayed as http://localhost:8080//#book_id=6&fmt=epub&library_id=library&mode=read_book and wondered if the file extension name after"fmt=" could be the problem. So I changed the ulr manually by removing the double slash and replacing "epub" with "pdf" , into http://localhost:8080/#book_id=6&fmt=pdf&library_id=library&mode=read_book, and the viewer was functioning as expected. I hope in the future the plugin will be able to detect the file extensions automatically and changed the respective urls in the macro renderer accordingly

duydl commented 8 months ago

A book could have many extensions so there is a setting in CalibreMetadata for user to set preferred format.

Also it is quite easy to change the format for already added book: {{renderer calibreViewer, special, http://localhost:8080/#book_id=6&fmt=epub&library_id=TEST&mode=read_book}} {{renderer calibreHighlight, false, 2000, http://localhost:8080, TEST, 6, epub}}

You just need to change the format i.e epub to pdf in the two renderer and calibre-annotation would function the same. The two plugins are quite independent actually.

Though in the future calibre metadata would know if a book only has one format, add that format instead of the preferred format in the settings.