mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
EPUB Input: Remove non XML documents from the spine automatically, instead of erroring out
This commit is contained in:
parent
013377db7e
commit
b19169d192
@ -321,6 +321,12 @@ class OEBReader(object):
|
|||||||
if len(spine) == 0:
|
if len(spine) == 0:
|
||||||
raise OEBError("Spine is empty")
|
raise OEBError("Spine is empty")
|
||||||
self._spine_add_extra()
|
self._spine_add_extra()
|
||||||
|
for item in spine:
|
||||||
|
if item.media_type.lower() not in OEB_DOCS:
|
||||||
|
if not hasattr(item.data, 'xpath'):
|
||||||
|
self.oeb.log.warn('The item %s is not an XML document.'
|
||||||
|
' Removing it from spine.'%item.href)
|
||||||
|
spine.remove(item)
|
||||||
|
|
||||||
def _guide_from_opf(self, opf):
|
def _guide_from_opf(self, opf):
|
||||||
guide = self.oeb.guide
|
guide = self.oeb.guide
|
||||||
|
Loading…
x
Reference in New Issue
Block a user