View Single Post
Old 12-07-2010, 02:48 PM   #3
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,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
This is a several stage process:

1) Come up with a calibre annotations "standard"

2) Write code to map the SONY annotations to the standard defined in (1)

3) Write code to map "standard" annotations to SONY annotations

4) Port the calibre e-book viewer to use the standard

5) Figure out the best way to store annotations in the calibre library

5.5) If the best way involves storing annotations outside ebook files, modify the metadata writers for EPUB to insert the annotations into the file when saving/sending to disk

6) Modify the SONY driver to use 3) and send annotations to the SONY so that they can be read by the SONY

I am planning to work on 1) and 4) as part of the embedded web viewer in the calibre content server.

Presumably, once 1) and 4) are done, the rest can be tackled. If you (or anyone else) wants to contribute to 1) or 4) feel free, if there are enough contributors, I'll setup a wiki page defining the annotations standard.

To get you started on 1):

The standard will have two parts

a) Defining a "location" in the ebook

Schemes that are used today in various ebook readers

- jquery selectors
- XPath selectors
- Adobe's usual opaque nonsense
- rendered position percentage
- text strings
- Binary offsets (Amazon the great)

A location IMO will need at least three levels

Level One: XPath selector
Level Two: text string
Level Three: rendered percentage

The idea being that if level one is unavailable use level two if that is unavailable use level three and so on.

The hardest part will be writing code to migrate legacy selectors to the standard scheme. The only way to reliably migrate for example, the Adobe location selector you described previously is to open the epub and parse the html to find what the selector points to and then convert that to XPath. And of course, I doubt Amazon's scheme will ever be migrated.

An then there is the question of identifying the ebook itself in the location (probably use the EPUB unique identifier).

You can of course come up with a much simpler solution if all you want to do is support the SONY devices, but I am not interested in that.
kovidgoyal is online now   Reply With Quote