Here is some background information that may be useful for your project.
The "My Clippings.txt" file relates notes and highlights to "locations" within the book. These are approximate references, but have the advantage of being independent of the book format.
For internal use the Kindle needs to know the start and end positions of notes and highlights to the exact character. There are different methods for resolving these positions based on the format of the book.
For the original MOBI/AZW format the position number is an offset within the raw HTML content of the book. You can divide the offset by 150 and add one to produce the equivalent location number.
For KF8/AZW3 it is more complicated. There is an internal record (DATP) that can be used to translate from position/offset to location number. DATP has a header and two tables. The second table gives the number of raw HTML bytes for each location. Add them up successively to derive the offset that is equivalent to each location.
For books in KFX format there is no raw HTML. Position numbers are mapped to text using internal tables. You would have to break a lot of new ground to correctly map positions to locations for that format.
Good luck.
Last edited by jhowell; 07-28-2017 at 07:57 PM.
|