View Single Post
Old 02-10-2013, 12:13 PM   #134
kaswistry
Member
kaswistry ought to be getting tired of karma fortunes by now.kaswistry ought to be getting tired of karma fortunes by now.kaswistry ought to be getting tired of karma fortunes by now.kaswistry ought to be getting tired of karma fortunes by now.kaswistry ought to be getting tired of karma fortunes by now.kaswistry ought to be getting tired of karma fortunes by now.kaswistry ought to be getting tired of karma fortunes by now.kaswistry ought to be getting tired of karma fortunes by now.kaswistry ought to be getting tired of karma fortunes by now.kaswistry ought to be getting tired of karma fortunes by now.kaswistry ought to be getting tired of karma fortunes by now.
 
Posts: 19
Karma: 472044
Join Date: Jan 2013
Device: Kindle Touch
Quote:
Originally Posted by Ephemerality View Post
I've actually been working quite a bit over the past week on creating an x-ray builder that generates all of the loc and chapter information by unpacking the mobi file and running through the raw book content (the page-by-page info is calculated on the Kindle itself).
The format is fairly simple, each loc points to a point in the book and defines the excerpts you see on that character's page. The locations are positions within the raw html file (I've been unpacking the mobis with mobi_unpack using the -r flag to get the raw markup). The default loc that the X-Ray builder here gives is [100,100,100,6], so say that is [A,B,C,D].
A is the start position of the excerpt.
B is is the length of the excerpt.
C is the position within the excerpt that starts being bolded.
D is the length of the bolded section.

Chapters are basically the same. For example, the last part of the .asc file:
"chapters":[{"name":"Chapter 1","start":1020,"end":6423},{"name":"Chapter 2","start":6423,"end":11294}],"srl":1020,"erl":11294}
Same thing, just the starting and ending positions in the file. The only trick here is that srl and erl have to be there as well to have the chapters show up; srl being the start of chapters and erl being the end of course. With those defined, plus the locs for each character, you also get to see the "progress bar" that the Amazon X-Rays have.


I took a look at the files, the Hypnotist one is definitely just the Wikipedia info, I took a look at Shelfari and there's actually no info for it (http://www.shelfari.com/books/326144...notist-A-Novel), so you'd have to modify the entry first. The Steve Jobs one seemed fine to me, but I plugged the asin and guid from a different book into it and tried it out, it gave the same error as you are getting. Now I can't get my own X-Ray files to work on that same book which was working before! So I have no idea what's going on there.
I would definitely try the site and a totally different book instead just to see if it makes a difference, I haven't even used the Calibre plugin so I don't know how well it works...

Edit: I did notice a code at the bottom of the error page which might help a bit as well.
SX = X-Ray file not valid
VS/VN/VO = Version number is anything but "1"
WA = Issue with ASIN
WG = Issue with GUID

Edit #2: I hadn't thought about it, but since the Calibre version already has access to the book it could definitely be modified to add the locs. My version is a separate program done in C# so it's not nearly as convenient...
Does that mean that it either works or not and that this goes for all books? Aww.
kaswistry is offline   Reply With Quote