('last_child', 23, 1, 128, 0), EndTagTable, ('pos_fid', 6, 2, 1, 0), EndTagTable))) if __name__ == '__main__': # Generate a document with a large number of index entries using both # calibre and kindlegen and compare the output import os, subprocess os.chdir('/t') paras = ['<p>%d</p>' % i for i in xrange(4000)] raw = '<html><body>' + '\n\n'.join(paras) + '</body></html>' src = 'index.html' with open(src, 'wb') as f: f.write(raw.encode('utf-8')) subprocess.check_call([ 'ebook-convert', src, '.epub', '--level1-toc', '//h:p', '--no-default-epub-cover', '--flow-size', '1000000' ]) subprocess.check_call([ 'ebook-convert', src, '.azw3', '--level1-toc', '//h:p', '--no-inline-toc', '--extract-to=x' ]) subprocess.call(['kindlegen', 'index.epub' ]) # kindlegen exit code is not 0 as we dont have a cover subprocess.check_call(['calibre-debug', 'index.mobi']) from calibre.gui2.tweak_book.diff.main import main main(['cdiff', 'decompiled_index/mobi8/ncx.record', 'x/ncx.record'])
('depth', 4, 1, 8, 0), ('kind', 5, 1, 16, 0), ('parent', 21, 1, 32, 0), ('first_child', 22, 1, 64, 0), ('last_child', 23, 1, 128, 0), EndTagTable, ('pos_fid', 6, 2, 1, 0), EndTagTable ))) if __name__ == '__main__': # Generate a document with a large number of index entries using both # calibre and kindlegen and compare the output import os, subprocess os.chdir('/t') paras = ['<p>%d</p>' % i for i in xrange(4000)] raw = '<html><body>' + '\n\n'.join(paras) + '</body></html>' src = 'index.html' with open(src, 'wb') as f: f.write(raw.encode('utf-8')) subprocess.check_call(['ebook-convert', src, '.epub', '--level1-toc', '//h:p', '--no-default-epub-cover', '--flow-size', '1000000']) subprocess.check_call(['ebook-convert', src, '.azw3', '--level1-toc', '//h:p', '--no-inline-toc', '--extract-to=x']) subprocess.call(['kindlegen', 'index.epub']) # kindlegen exit code is not 0 as we dont have a cover subprocess.check_call(['calibre-debug', 'index.mobi']) from calibre.gui2.tweak_book.diff.main import main main(['cdiff', 'decompiled_index/mobi8/ncx.record', 'x/ncx.record'])