Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 05-01-2022, 05:58 PM   #1
acarter5
Junior Member
acarter5 began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Feb 2022
Device: onyx boox note air
How to access TOC?

I'm writing a plugin for exporting annotations as JSON but I noticed that some of my annotations are missing the chapter data.

Is there a way to access a book's TOC from the book_id? I'd need to access to TOC either in a subclass of the USBReader class or the Export class.

Follow up question: is there a method on the toc model for getting a chapter title from a page number?
acarter5 is offline   Reply With Quote
Old 05-01-2022, 09:53 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: 43,976
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
There is no (simple) api for accessing tocs. In general you would use the polish container class with an epub or azw3 book to get tocs.

And none whatsoever for getting titles from page numbers (page numbers are very ill defined things).

ToC information when available is automatically added to annotations when they are creted. If it isnt there, it means it was not available.
kovidgoyal is offline   Reply With Quote
Old 05-02-2022, 01:54 AM   #3
acarter5
Junior Member
acarter5 began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Feb 2022
Device: onyx boox note air
Quote:
Originally Posted by kovidgoyal View Post
There is no (simple) api for accessing tocs. In general you would use the polish container class with an epub or azw3 book to get tocs.

And none whatsoever for getting titles from page numbers (page numbers are very ill defined things).

ToC information when available is automatically added to annotations when they are creted. If it isnt there, it means it was not available.
Would it be possible to get the chapter title with the XPath of the annotation?
acarter5 is offline   Reply With Quote
Old 05-02-2022, 04:23 AM   #4
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: 43,976
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by acarter5 View Post
Would it be possible to get the chapter title with the XPath of the annotation?
Anything is possible if you are wiling to write the code for it, but there isnt any pre-exisitng code for it.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Glo Quick method to access TOC ?. leftright Kobo Reader 17 07-30-2014 06:30 AM
One-click access to the metadata TOC PatNY Sony Reader 0 01-21-2011 06:47 PM
Kobo Firmware Access and Early Access Program PeterT Kobo Reader 115 08-09-2010 08:06 PM
pocketbook 360...access epub toc and zoom tables? extendedping PocketBook 3 07-28-2010 12:18 PM
pocketbook 360...access epub toc and zoom tables? extendedping PocketBook 8 07-27-2010 01:47 PM


All times are GMT -4. The time now is 11:39 PM.


MobileRead.com is a privately owned, operated and funded community.