[svlug] ePub processing: was Some pretty serious parsing

Steve Litt slitt at troubleshooters.com
Sun Nov 15 12:50:06 PST 2015


On Sun, 15 Nov 2015 13:05:35 -0700
Akkana Peck <akkana at shallowsky.com> wrote:


> Examine and tweak existing epubs.
> https://github.com/akkana/scripts/blob/master/epubtag.py

Nice!

I'll have questions about the file as a whole, but meanwhile, I think
extract_cover_image() is greatly overthought. *Structurally speaking*,
a book has a cover if and only if there exists an element in the OPF's
Guide section with "type=\"cover\"". That element's href points to the
"thing" that's a cover. If the thing is an image, that's your cover
image. If the thing is an (X)html file, hopefully the author has had
the good manners to include only one image file within, so that image
file becomes your cover image.

Either way, it's pretty trivial to, in an automated way, replace that
particular graphic with a SVG derived graphic with all the proper info.
Or, if you want to go back and change all info related to that
particular image, you could "do the right thing" and make it an SVG,
which, from what I understand, is the preferred image format for eBooks.

SteveT

Steve Litt 
November 2015 featured book: Troubleshooting Techniques
     of the Successful Technologist
http://www.troubleshooters.com/techniques



More information about the svlug mailing list