View Single Post
Old 03-07-2012, 12:34 PM   #8
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,644
Karma: 5433388
Join Date: Nov 2009
Device: many
could we create a conversion plugin

Hi,

Looking at the calibre source archive, I see there are conversion plugins much like there are file type plugins. Given the Mobi_Unpack code can convert a kf8 ebook to its original epub, would it be possible to create a new conversion plugin that runs at higher priority than the current mobi_input.py that does the following:

1. works on all mobi/azw ebooks
2. check to see if KF8 (standalone or dual) or just original mobi
3. if just original passes it to the current mobi_input.py plugin
4. if Kf8 (assume the user would prefer the kf8 version since it supports fonts and things and then use the code in Mobi_Unpack to convert the mobi KF8 format piece to its original epub
5. then call the epub_input.py plugin

I looked and one of the input plugins can call another input plugin (this is done in htmlz which invokes the html plugin) so unless I am misundertanding things, this should be possible.

So when people load an original mobi ebook, they get a .mobi, but if they load a KF8 mobi ebook, they effectively get an epub. This would work well for viewing a KF8 inside Calibre, and for converting it (already is an epub so calibre can convert it to whatever format including the original mobi).

The only drawback is that there would be no way to generate KF8 output since creating it takes much more work (and reverse engineering) than simply reading it. But I think something like this would work to get KF8 support (at least input and conversion) into calibre in a very short time window.

For the right person (DiapDealer! ...;-) , this might take only a day or two to create.

My 2 cents ...

KevinH
KevinH is offline   Reply With Quote