View Single Post
Old 08-06-2021, 11:20 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,415
Karma: 27757236
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
look in db/cache.py at functions with *annotations* in their name. Annotations in calibre are simple JSON objects that store highlighted text and start and end positions as EPUB CFI paths, alongwith colors/styles. Just creating a few different annotations with the calibre viewer and examining the resulting obets will do the trick.

You can get the db/cache.py object like this:

from calibre.library import db
cache = db('/path/to/library/folder').new_api

this is from a standalone script run via calibre-debug if you are in a gui plugin then you get it as:

from calibre.gui2.ui import get_gui()
cache = get_gui().current_db.new_api
kovidgoyal is offline   Reply With Quote