View Single Post
Old 12-23-2020, 09:52 AM   #15
chris33
Enthusiast
chris33 began at the beginning.
 
Posts: 35
Karma: 10
Join Date: Sep 2020
Device: ipad, kobo libra 2
Quote:
Originally Posted by chaley View Post
Does calibre.ebooks.metadata.opf.set_metadata do what you want?

Also, calibre.db.cache.get_metadata() returns the metadata for a given book id. You can get a db object using gui.library_view.model().db, which gives you access to the methods in db.legacy. You probably want to use gui.library_view.model().db.new_api so you can use the newer methods in db.cache.
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.
But how can I get the book/container object from the current GUI selection ?
chris33 is offline   Reply With Quote