View Single Post
Old 12-23-2020, 12:18 PM   #17
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by chris33 View Post
It sounds good. I guess I can reuse the code found in function update_metadata
in ../calibre-src/src/calibre/ebooks/oeb/polish/main.py.
It looks like it will do the job.
If you haven't already, look at API documentation for the e-book editing tools.
Quote:
But how can I get the book/container object from the current GUI selection ?
First get the book's metadata (mi). For examples of how to do that look at almost any GUI plugin. Examples might be Embed Comic Metadata and Manage Series. Once you have the mi you can get the book path from mi.format_metadata[format_name]['path'].

You can also get the format_metadata using db.format_metadata(). You can get the paths using db.format_files().

There are many examples in calibre of using these methods.
chaley is offline   Reply With Quote