+ if cover_fn:
+ cover = StringIO()
+ cover_fn(book_info.author.readable(), book_info.title).save(cover, format='JPEG')
+ zip.writestr(os.path.join('OPS', 'cover.jpg'), cover.getvalue())
+ del cover
+ zip.writestr('OPS/cover.html', open(get_resource('epub/cover.html')).read())
+ manifest.append(etree.fromstring(
+ '<item id="cover" href="cover.html" media-type="application/xhtml+xml" />'))
+ manifest.append(etree.fromstring(
+ '<item id="cover-image" href="cover.jpg" media-type="image/jpeg" />'))
+ spine.insert(0, etree.fromstring('<itemref idref="cover" />'))
+ opf.getroot()[0].append(etree.fromstring('<meta name="cover" content="cover-image"/>'))
+ opf.getroot().append(etree.fromstring('<guide><reference href="cover.html" type="cover" title="Okładka"/></guide>'))
+
+