you need to write a plugin that has a method convert that accepts an OPF file. It should take the list of html files specified in the <manifest> of the OPF file in the order specified by the <spine> (note that calibre has classes to deal with OPF files) and create a .MOBI file from that list of HTML files.
Since MOBI supports a proprietary superset of HTML 3.2 you're going to have to do a lot of conversion of the HTML, or you can just call mobigen.
The problem with that is that mobigen is not available on OS X.
|