Plugins for Calibre Integration. Finally annotations sync for epub, etc

Named logseg-calibre-metadata and logseq-calibre-annotation on Logseq Marketplace.

The first is for auto-creating page like the built-in Zotero integration.

demo1

The second is for reading ebook while having annotation syncing to logseq.

demo6

These two plugins can function independently. The calibreMetadata plugin only creates the page and inserts the renderers used by the calibreAnnotation plugin.

Calibre Content Server is very convenient. We can connect and read books with a browser from any device, and the annotations will still seamlessly sync to the page.

Amazing! Kudos!

Does editing an annotation in Logseq also update the one in Calibre or the sync is only to one direction?

Nah, it just syncs one way. It’d be handy for me when I’m chilling in bed, reading a book on my phone, and jotting down some notes. Those notes would be synced to Logseq. Since the notes in Logseq are the final version though, there’s not much point in pushing them back into the book. Technically, it could be done, but it might require tweaking the Calibre API a bit.

2 Likes

This is best thing I’ve heard in a while.

My previous solution was to use logseq:// links in the Book Details pane (I had first done it with obsd) to create the pages for books, authors, etc, but some data loss forced me to restore a very old backup of calibre and I haven’t felt like setting it up properly again.

This is easier to set up and more functional. It might be interesting to add a place to copy and paste links that can go in Book Details based on the template set in the settings for this plugin. Automatic page properties would be a cool addition in the future as well, especially if they can pull data from custom columns

calibre-metadata adds a link to book detail in Calibre next to the two renderers. There is a convenient URL scheme for this i.e calibre://show-book/LibraryName/9. I need to update the gif demo.
Ther
e is work for the page property, as different data formats prefer different processing. Right now it is honestly minimal and may even lead to error when some property (like atm “rating”) are specified. I am always ready for feedback to improve.

Hello! Thank you for creating this! I am trying to use the plugin but everytime I do i get an error that logseq cannot connect to calibre API and to make sure the content server is on. My content server is on, and when I change the content server link as suggested, i still get the same error or a simple fail error. What am I doing wrong?

1 Like

Sorry to hear about your problem. Please try the following methods to help me debug it:

  1. Press “Ctrl + Shift + i” in Logseq to access DevTool. Tell me the message when you fail to import a book.

  2. Try paste the following URL into browser to see if the API to the books data could be accessed. Where serverLink and calibreLibrary is the value in the calibreMetadata setting.

serverLink + “/ajax/books/” + calibreLibrary

  1. If you have installed the calibreAnnotation plugin, open a book on the browser and paste the following macro into logseq, replace the link with the link to your calibre server. Clicking on the rendered button to see if the book appear on the side.
    {{renderer calibreViewer, special, http://192.168.11.2:8081/#book_id=42&fmt=epub&library_id=Fiction&mode=read_book}}

This is the message I get when I fail to import a book:

   GET https://192.168.165.20:8080/ajax/books/NCS net::ERR_SSL_PROTOCOL_ERROR

Fetch error: TypeError: Failed to fetch
at index.0336bf64.js:131:122
at index.0336bf64.js:140:499
at fn (index.0336bf64.js:1:70632)
at index.0336bf64.js:3:1

I have to apologize, but I know absolutely nothing about coding or anything related to that, so the second and third point sound like a completely different language. I don’t know where to paste any of these commands.

Okay, I think changing https to http would solve your problem.

Though, what I meant in method 2 was simply pasting the following into browser when content server is on.

image

this error returns

how to configure?

  • Find the Connect/share option on Calibre topbar, start the content server if not yet:
    image
    With the info in the screenshot, setting for Content Server Link is http://192.168.11.2:8081

  • Your current library name also shown in the topbar. i.e Calibre Library: Calibre
    image

  • Probably unrelated but you could also edit the port in Preferences. Navigate to this part:

I had the same problem. The reason was, that I had not understood what is meant with “Preferred Calibre Library”. It’s simply the name of the Calibre library I am using, in my case “Calibre”. When I put it in, everything worked :slight_smile:

thank you very much, it worked

I am unable to install the plugin. Here is the error message. Please advise.

calibre, version 7.13.0
ERROR: Unhandled exception: InvalidPlugin:The plugin in ‘/home/mel/Downloads/logseq-calibre-metadata-1.2.1.zip’ is invalid. It does not contain a top-level init.py file

calibre 7.13 embedded-python: True
Linux-5.15.0-113-generic-x86_64-with-glibc2.38 Linux (‘64bit’, ‘ELF’)
(‘Linux’, ‘5.15.0-113-generic’, ‘#123~20.04.1-Ubuntu SMP Wed Jun 12 17:33:13 UTC 2024’)
Python 3.11.5
Interface language: None
EXE path: /app/lib/calibre/bin/calibre
Successfully initialized third party plugins: DeACSM (0, 0, 16) && DeDRM (7, 2, 1)
Traceback (most recent call last):
File “calibre/gui2/preferences/plugins.py”, line 322, in add_plugin
File “calibre/customize/ui.py”, line 525, in add_plugin
File “calibre/customize/ui.py”, line 76, in load_plugin
File “calibre/customize/zipplugin.py”, line 297, in load
File “calibre/customize/zipplugin.py”, line 392, in _locate_code
calibre.customize.InvalidPlugin: The plugin in ‘/home/mel/Downloads/logseq-calibre-metadata-1.2.1.zip’ is invalid. It does not contain a top-level init.py file

Welcome!
I could be mistaken, but it looks to me like you are trying to install the plugin in Calibre, while it is meant to be installed in Logseq (it is a plugin for the latter).

OK. Great. But having never used Logseq, and all I want to do is take notes as I read a book, I cannot figure out how to open an epub book in Logseq. I installed the 2 plugins for Logseq and started the calibre server, but the behavior of Logseq does not look like it does in your GIFs/videos. Please advise.

Glad you managed to install the plugins.
To help you, more detailed information is needed. Which behavior are you not able to replicate? Where does the actual deviate from the expected? etc.

I cannot find any way to view an epub in Logseq. The GIF above appears to open the epub in Logseq from Calibre, but I cannot find any similar method in my installation.

hi,

few steps to suggest:

1, you need to start calibre network: go to calibre → connection/share → Start Content Server
2, go to logseq, on any page, type “/calibre: add a calibre book”
3, then as shown above, type book name and enter

the book will load into your logseq

1 Like