From 6550c18745c5eb6b4b424f5a9b9bcb96fa5fe6d2 Mon Sep 17 00:00:00 2001 From: "Marshall T. Vandegrift" Date: Thu, 18 Dec 2008 22:51:25 -0500 Subject: [PATCH] Detect an NCX TOC which isn't mentioned by the /spine/@toc. --- src/calibre/ebooks/lit/oeb.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/lit/oeb.py b/src/calibre/ebooks/lit/oeb.py index 9bf1eb8c82..acc3275876 100644 --- a/src/calibre/ebooks/lit/oeb.py +++ b/src/calibre/ebooks/lit/oeb.py @@ -602,7 +602,10 @@ class OEBBook(object): def _toc_from_ncx(self, opf): result = xpath(opf, '/o2:package/o2:spine/@toc') if not result: - return False + expr = '/o2:package/o2:manifest/o2:item[@media-type="%s"]/@id' + result = xpath(opf, expr % NCX_MIME) + if len(result) != 1: + return False id = result[0] ncx = self.manifest[id].data self.manifest.remove(id)