View Single Post
Old 01-02-2014, 08:33 PM   #52
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by spitfire_ch View Post
I don't have a kobo - hence I don't qualify as guinea pig. However, I am highly interested in your class for the Kobo devices. I am still trying to wrap my head around Sony annotations, and from what I have seen somewhere else, Sony and Kobo might use the same or at least a similar system to store annotations. Sony uses something similar to a canonical fragment identifier:
text/part0000_split_005.html#point(/1/4/9:2) (one position before the beginning of the highlight)
text/part0000_split_005.html#point(/1/4/10/1:1) (end of highlight)

Nook must use something alike:
https://www.mobileread.com/forums/showthread.php?t=99000

Looks the same to me
Yes, they are pretty much the same. And the reason is that they are the format ADE uses. Kobo and Sony uses a version of the Adobe RMSDK for reading epubs. In fact, as well as storing the annotations in a database, the Kobo writes them to a file. This file is identical to what ADE uses for annotations on Windows. I have copied the file between the two with some massaging.

I should add, the Kobo devices use two different readers. The other is for their own modified kepubs. The other reader uses a different bookmarking method.
Quote:
I already partially figured out how this works:
/1 indicates the root element (<html...)
even numbers navigate through the elements. So 2 is the first child of the root (<head...), 4 is the second child of the root (<body...), /1/4/10/ is the 5th child of the body (usually the 5th paragraph or header).
: idicates the offset within the element.
Yes, that is my understanding as well.
Quote:
However, I am not quite sure what odd numbers mean. They usually occur if the highlight starts at the beginning of the paragraph. So the position before the highlight is "between the paragraphs". But in case of /1/4/9:2 --> what's the second character of "between paragraph 4 and 5? Do you happen to know that, by chance?
It has been a while since I looked at this. I think that the count is for opening and closing tags at the same level and starts from zero. The count seems to be ignoring self closed tags, but I'd need to do some more testing to prove that. Each number definitely represents a level of nesting. I have a blockquote with several paragraphs in it. The paragraphs are counted within that.

I might have a bit of a play later. It will give me something to do while hiding from the in-laws.
Quote:
So, I am almost there, but not quite. I was hoping that looking at your code might help me to figure out the remaining gaps - and also give me an idea to write code to navigate using this kind of identifiers.
Unfortunately, it won't help. I don't touch the locations. I am only pulling out the highlighted text, the note, a timestamp and enough information to give the order within the list of annotations.

And my Kobo Utilities plugin won't help. It will store the current reading position, but it is the full string. I have considered trying to translate this to the method that calibre uses. That way I could update the position for the calibre viewer, but I haven't seen the need yet. I would actually be interested to know if the reading position on the Sony devices are stored somewhere accessible and in what format. Because of the common Adobe RMSDK, I have been wondering of the Kobo position could be copied to the Sony devices.
Quote:
Thank you very much for any ideas - or the code ...
If you want the code, I can PM you a link.
Quote:
... and of course all the very best in 2014!!
Yes, Happy New Year to everyone.
davidfor is offline