mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-02-10 03:14:38 +01:00
EPUB Input: Filter made media tytpes from the spine, currently only filter Adobe page templates
This commit is contained in:
parent
940969619c
commit
d34451b6d1
1 changed files with 13 additions and 0 deletions
|
|
@ -175,6 +175,19 @@ def convert(self, stream, options, file_ext, log, accelerators):
|
|||
raise ValueError(
|
||||
'EPUB files with DTBook markup are not supported')
|
||||
|
||||
for x in list(opf.iterspine()):
|
||||
ref = x.get('idref', None)
|
||||
if ref is None:
|
||||
x.getparent().remove(x)
|
||||
continue
|
||||
for y in opf.itermanifest():
|
||||
if y.get('id', None) == ref and y.get('media-type', None) in \
|
||||
('application/vnd.adobe-page-template+xml',):
|
||||
p = x.getparent()
|
||||
if p is not None:
|
||||
p.remove(x)
|
||||
break
|
||||
|
||||
with open('content.opf', 'wb') as nopf:
|
||||
nopf.write(opf.render())
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue