I made a quick test with set_metadata and it was slower than single field edit even for one book. It compounded the problem and calls Last Modified plugin multiple times per field per book.
Code:
from calibre_plugins.action_chains.actions.base import ChainAction
class Test(ChainAction):
name = 'Test set_metadata'
support_scopes = True
def run(self, gui, settings, chain):
book_ids = chain.scope().get_book_ids()
db = gui.current_db
cache = db.new_api
if len(book_ids) == 0:
return
for book_id in book_ids:
#mi = cache.get_proxy_metadata(book_id)
mi = cache.get_metadata(book_id)
mi.set('#test1', 'text')
cache.set_metadata(book_id, mi)
Edit: It seems set_metadata() is calling set_field() for every field, even if the field value was not changed.