Fix #5342 (Calibre viewer no longer displays covers)

This commit is contained in:
Kovid Goyal 2010-04-22 03:50:37 -06:00
parent 6febcf3558
commit c937c7cdce

View File

@ -212,11 +212,12 @@ class EbookIterator(object):
cover = self.opf.cover cover = self.opf.cover
if self.ebook_ext in ('lit', 'mobi', 'prc', 'opf') and cover: if self.ebook_ext in ('lit', 'mobi', 'prc', 'opf') and cover:
cfile = os.path.join(os.path.dirname(self.spine[0]), cfile = os.path.join(self.base, 'calibre_iterator_cover.html')
'calibre_iterator_cover.html') chtml = (TITLEPAGE%os.path.relpath(cover, self.base).replace(os.sep,
chtml = (TITLEPAGE%cover).encode('utf-8') '/')).encode('utf-8')
open(cfile, 'wb').write(chtml) open(cfile, 'wb').write(chtml)
self.spine[0:0] = [SpineItem(cfile)] self.spine[0:0] = [SpineItem(cfile,
mime_type='application/xhtml+xml')]
self.delete_on_exit.append(cfile) self.delete_on_exit.append(cfile)
if self.opf.path_to_html_toc is not None and \ if self.opf.path_to_html_toc is not None and \