Quote:
Originally Posted by chaley
This template contains an example of what you put "here".
|
It worked!
Thanks, chaley. You're awesome.
I tweaked it a little, and here is the complete module code that adds an empty book, in case it's of interest to anyone else:
Code:
from calibre_plugins.action_chains.actions.base import ChainAction
from calibre.ebooks.metadata.book.base import Metadata
class AddEmpty(ChainAction):
name = 'Add Empty'
def run(self, gui, settings, chain):
db = gui.current_db
ids, duplicates = db.new_api.add_books([(Metadata(None), {})])
db.data.refresh()
gui.library_view.model().resort()
gui.tags_view.recount()
newid = ids[0]
gui.library_view.select_rows([newid])