View Single Post
Old 03-18-2025, 12:49 PM   #1447
fidvo
Addict
fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.
 
Posts: 309
Karma: 1645952
Join Date: Jun 2012
Device: none
Quote:
Originally Posted by chaley View Post
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])
fidvo is offline   Reply With Quote