def unpackMOBI(self, outdir): _mu.unpackBook(self.infile, outdir, epubver=self.ePubVersion, use_hd=self.useHDImages) mobidir = os.path.join(outdir, 'mobi7') mobiBaseName = os.path.splitext(os.path.basename(self.infile))[0] mobi_opf = os.path.join(mobidir, 'content.opf') mobi_html = os.path.join(mobidir, 'book.html') if not os.path.exists(mobi_html): raise Exception(_('Problem locating unpacked html: {0}'.format(mobi_html))) if not os.path.exists(mobi_opf): raise Exception(_('Problem locating unpacked opf: {0}'.format(mobi_opf))) return (mobidir, mobi_html, mobi_opf, mobiBaseName)
def unpackEPUB(self, outdir): src = None _mu.unpackBook(self.infile, outdir, epubver=self.ePubVersion, use_hd=self.useHDImages) if os.path.exists(os.path.join(outdir, 'kindlegensrc.zip')): src = os.path.join(outdir, 'kindlegensrc.zip') kf8dir = os.path.join(outdir, 'mobi8') kf8BaseName = os.path.splitext(os.path.basename(self.infile))[0] opf = os.path.join(kf8dir, 'OEBPS', 'content.opf') if not os.path.exists(opf): opf = None epub = os.path.join(kf8dir, '{0}.epub'.format(kf8BaseName)) if not os.path.exists(epub): raise Exception(_('Problem locating unpacked epub: {0}'.format(epub))) return (epub, opf, src)