diff --git a/src/calibre/ebooks/epub/input.py b/src/calibre/ebooks/epub/input.py index ac1d61ce59..c2cfedd7d4 100644 --- a/src/calibre/ebooks/epub/input.py +++ b/src/calibre/ebooks/epub/input.py @@ -180,7 +180,7 @@ class EPUBInput(InputFormatPlugin): for y in opf.itermanifest(): id_ = y.get('id', None) if id_ and y.get('media-type', None) in \ - ('application/vnd.adobe-page-template+xml',): + ('application/vnd.adobe-page-template+xml','application/text'): not_for_spine.add(id_) for x in list(opf.iterspine()): @@ -189,6 +189,9 @@ class EPUBInput(InputFormatPlugin): x.getparent().remove(x) continue + if len(list(opf.iterspine())) == 0: + raise ValueError('No valid entries in the spine of this EPUB') + with open('content.opf', 'wb') as nopf: nopf.write(opf.render())