Quote:
Originally Posted by Howlingwolf
I was testing an idea for programmatically adding books to a Calibre library and encountered a problem with custom columns.
I'm using mi.set('#subtitle', Subtitle) - following this with mi.get('#subtitle') shows the data is being set correctly - but this is not being 'carried over' into the library metadata.
This is a 'standalone' script run using calibre-debug, not a plugin.
Is this related to the metadata plugin issue I've seen mentioned elsewhere or something I'm doing wrong?
|
You are doing something wrong.
mi.set changes the value in the metadata instance (in memory). It does not write that value to the database. To write to the database you should use new_api.set_field() (db.cache.py) if you are writing only a few fields or set_metadata() (db.legacy.py or cache.py) if you are changing many fields. Both assume that you have access to a database instance.
The thread
https://www.mobileread.com/forums/sho...d.php?t=241680 has an example of using set_field.