View Single Post
Old 04-27-2011, 05:11 AM   #106
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
I think I'd have to leave the full illumination on cover handling to Kovid, I don't actually know that code. I also generally avoid epub->epub conversions for the same reasons you do and manually update covers when so motivated (which is actually infrequent).

Based on the behavior I see when adding books it seems like Calibre will grab the jpg file that represents the cover if the OPF/Guide actually specifies it as a cover - other times it just renders the html of the first page to an image, which seems to indicate that there aren't any significant heuristics going on to test if the file is a cover when the manifest is silent.

As far as the things that happen during conversion, it's relatively easy to disable things that happen in the structure detection phase, which is what causes new split points, TOC changes, etc, but disabling stuff that happens later in the pipeline is pretty difficult, in particular css flattening, font size rescaling, etc. This is the bigger reason I avoid it as I don't want to change the css wholesale when the original css was good/easy to tweak in Sigil.

Kovid's mentioned a framework he started called epub-fix, it's discussed a bit in this bug:
http://oldbugs.calibre-ebook.com/ticket/8252#comment:5

It might offer a way to hook into some of this.

Other features/functions that exist that might be able to help from a plugin are:
  • The save-to-disk feature - this will insert new covers/update metadata without doing an epub->epub conversion. I don't believe Calibre offers a way to do this directly to the books inside the library, which would be nice.
  • The 'remove first image' option in the conversion pipeline might also be useful. You might be able to write a plugin that optionally removes the first image with that feature and inserts a new cover a'la save-to-disk without actually saving the file to a new location.
ldolse is offline   Reply With Quote