seandenigris / Living-Library

MIT License
4 stars 1 forks source link

Calibre - query current viewer location #10

Open seandenigris opened 2 years ago

seandenigris commented 2 years ago

Use case: a book is open in the Calibre viewer. We want a note with a citation. We'd like to get the current location and/or the reference mode location from the GT side. Corollary: it seems that there are cited notes i.e. "where was I in the book when I had this thought" as well as what we've had so far i.e. quotes and paraphrases. Maybe another type e.g. note/paraphrase/quote.

Having access to the current viewer location would make citing much easier. I asked if it's possible on the Calibre forum. It's not looking good. Since Calibre seems to be written mostly in Python, perhaps we can add the feature?

Playing around and reading the manual a bit, I was able to interface with Calibre a bit from python via calibre-debug:

from calibre.library import db
db = db('/path/to/Calibre Library').new_api
print(db.all_book_ids())
print(db.field_for('title', 145))

The above was cobbled together from the library API doc