Quote:
Originally Posted by slowsmile
To illustrate this, here is the metadata cover ref I get in the opf metadata when I load an epub created by Scrivener into Sigil:
<meta content="cover-image" name="cover" />
How can I get the cover file name from that line?
|
That's actually fairly easy, because you can use
bk.id_to_href() to get the href. For example:
Code:
metadata_soup = BeautifulSoup(bk.getmetadataxml(), 'lxml')
cover_image = metadata_soup.find('meta', {'name' : 'cover'})
if cover_image:
cover_id = cover_image['content']
cover_href = bk.id_to_href(cover_id)
For more information, see my
KindleGen plugin which'll check for the presence of all recommended guide/landmarks items and cover image identifiers in epub2 and epub3 books.