View Single Post
Old 08-23-2018, 02:24 AM   #14
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,731
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by slowsmile View Post
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.

Last edited by Doitsu; 08-23-2018 at 02:27 AM.
Doitsu is offline   Reply With Quote