[svlug] ePub processing: was Some pretty serious parsing

Steve Litt slitt at troubleshooters.com
Sun Nov 15 13:05:03 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

In save_changes(), I don't see any code to guarantee that file mimetype
is not compressed. I was under the impression this file must remain
uncompressed, even if the rest of the .zip is compressed.

Also, your code in save_changes() quits after finding one .opf file.
I'm not sure, but I think it's an error condition to have multiple .opf
files. But of course, it happens, and I think I've had various magical
ePub writers do it.  You might want to consider a loop at the top of
save_changes() to find all .opf files, and if more than one is found,
list them and error out, or at least ask the person which is the right
one and inform him 2 is an error condition (I can't think of a reason
for multiple .opf files).

Cool program!


Steve Litt 
November 2015 featured book: Troubleshooting Techniques
     of the Successful Technologist

More information about the svlug mailing list