@Kovid: I'm actually doing it in two different ways depending on whether it is done in a background job or in the foreground. This is historical, I did the foreground version first and am adding the background so I can automate things.
For the foreground version, I have:
Code:
library_db.set_custom(book.calibre_id, last_read, label=last_read_col_label, commit=False)
With a "library_db.commit()" after the loop finishes.
I can make the change to the new DB engine method.
But, Peter is using the background job. This reads the device database and collects the new values. Then it prompts the user if they want to update and then does a set of the following for each book:
Code:
mi.set_user_metadata(last_read_column, last_read_col)
Followed by:
Code:
edit_metadata_action = self.gui.iactions['Edit Metadata']
edit_metadata_action.apply_metadata_changes(id_map)
This was "borrowed" from one of kiwidude's plugins. If there is a better way to do this now, I would be happy to hear it.