From 173a3cbd9c5f5824e887bc2ebfc1aeb6849a3064 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Feb 2013 17:12:00 +0530 Subject: [PATCH] E-book viewer: When viewing epub files that have their cover marked as non-linear, show the cover at the start of the book instead of the end. Fixes #1126030 (Epub file: import ziped and cover position) --- src/calibre/ebooks/conversion/plugins/epub_input.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/calibre/ebooks/conversion/plugins/epub_input.py b/src/calibre/ebooks/conversion/plugins/epub_input.py index 11499e75cc..642235e595 100644 --- a/src/calibre/ebooks/conversion/plugins/epub_input.py +++ b/src/calibre/ebooks/conversion/plugins/epub_input.py @@ -103,6 +103,12 @@ class EPUBInput(InputFormatPlugin): if not self.for_viewer: spine[0].getparent().remove(spine[0]) removed = guide_cover + else: + # Ensure the cover is displayed as the first item in the book, some + # epub files have it set with liner='no' which causes the cover to + # display in the end + spine[0].attrib.pop('linear', None) + opf.spine[0].is_linear = True guide_elem.set('href', 'calibre_raster_cover.jpg') from calibre.ebooks.oeb.base import OPF t = etree.SubElement(elem[0].getparent(), OPF('item'),