View Single Post
Old 01-15-2013, 11:15 PM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,361
Karma: 4961459
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Cant think of an example, but the basic procudure is to follow the set_metadata() function in metadata/epub.py. Something like

Code:
reader = get_zip_reader(stream, root=os.getcwdu())
opf = reader.opf
for author in opf.authors_path(opf.metadata):
     author.getparent().remove(author)
and so on (see the authors()->fset function in opf2.py)
and then do
newopf = StringIO(opf.render())
do the replacing as in set_metadata()
kovidgoyal is offline   Reply With Quote