Comment 9 for bug 748741

Revision history for this message
Kovid Goyal (kovid) wrote :

Well, I've spent two weeks on this, and I can't get it to work. So I'm giving up as I have many other things I need to work on in calibre. If anybody wants to pick up where I've left of, go to preferences->tweaks and add a plugin tweak

new_mobi_writer = True

This will cause calibre to use my new code. The new code generates all the indexing data, including the trailing byte sequences in the same way as kindlegen 1.2. It also wraps sections and articles in <divs> and adds an empty div tag at the end of every article. The resulting MOBI has a working "View articles list", but reading articles and going back to the sections list does not preserve your place.

I suspect that for that to work, we need some special markup in the HTML itself, but I'm out of patience with this.

You can decompile any MOBI produced with my new code or with kindlegen 1.2 by running

calibre-debug --inspect-mobi filename.mobi

This generates a nice textual representation of all the data in the MOBI file including indexing records and trailing byte sequences.

The new code is in calibre.ebooks.mobi.writer2 it is nicely modularized and much easier to understand/modify than the original.

If you plan to work on this and have questions, feel free to ask me by posting to this ticket.