From 484d58baa37dcb3a46d8f3691f034c8d84fb34ce Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 28 Jun 2012 19:27:46 +0530 Subject: [PATCH] EPUB Input: When there are multiple elements of the same type in the OPF guide, use the first rather than the last element. --- src/calibre/ebooks/oeb/reader.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/reader.py b/src/calibre/ebooks/oeb/reader.py index 57fa974bb3..8124d49c6a 100644 --- a/src/calibre/ebooks/oeb/reader.py +++ b/src/calibre/ebooks/oeb/reader.py @@ -347,7 +347,9 @@ class OEBReader(object): self.logger.warn(u'Guide reference %r not found' % href) continue href = corrected_href - guide.add(elem.get('type'), elem.get('title'), href) + typ = elem.get('type') + if typ not in guide: + guide.add(typ, elem.get('title'), href) def _find_ncx(self, opf): result = xpath(opf, '/o2:package/o2:spine/@toc')