View Single Post
Old 12-01-2011, 02:42 PM   #1
rodrigoccurvo
Member
rodrigoccurvo began at the beginning.
 
Posts: 14
Karma: 10
Join Date: May 2011
Location: Campo Grande, MS, Brazil
Device: Kindle 3
Lightbulb Correct Mobi location formula (maybe)

Hi, everyone.

For a while I've been trying to understand Kindle's location and the consensus seems to be that for Mobi 1 location = 128 bytes (it's even on https://wiki.mobileread.com/wiki/Page_numbers).

But today I was taking a look at the Amazon Cloud Reader (reader.amazon.com) source code and I found the following:

Code:
locationFromPosition: function (a) {
        return Math.floor(a * 2 / 300 + 1)
}
(The file is KindleReaderApp-min.js, but I won't post the whole link since it's weird and I don't know if it has session informations. I guess you can find it on your own.)

The surrounding code is a bit larger, but in the end that seems to be the formula used for calculating the location for the Mobi format (there is another for topaz which is Math.floor((a * d + 100) / 100)).

I've tried looking at the parameter "a" and for the text parts it seems to be characters, but I don't know if that means bytes for every case. I've tested it a little bit just to know if it's correct and it seems to be, but not enough for me to be sure. Also, I don't know if the relation holds for images and other things apart from characters.

I don't know and couldn't find the original source for the 128 bytes information, so I'm guessing it's an approximation. But as I said, in my initial tests the above formula seems to work.

What to you guys think? Does it make sense? Is the 128 bytes info an approximation or is it on the format specs?

[]'s

Rodrigo
rodrigoccurvo is offline   Reply With Quote