View Single Post
Old 01-06-2025, 05:50 PM   #1
mactastik
Junior Member
mactastik began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jan 2025
Device: none
calibre python script to update custom fields (help)

I'm working on converting over from goodreads to calibre. So far, so good. One of the things I'd like is two custom fields: Read and Stars to match whether I've read the book or not and the stars I give the book.

I was able to make the fields and can set them manually in Calibre no problem. I can read in and match books pretty well, but I can't seem to store the custom fields via python. Here's what I have (in brief):

Code:
metadata = calibre_db.get_metadata(id)
stars = metadata.get_user_metadata("#stars", True)
stars["#value#"] = 4
metadata.set_user_metadata("#stars", stars)
read = metadata.get_user_metadata("#read", True)
read["#value#"] = True
metadata.set_user_metadata("#read", read)
I can print values that I've manually entered, so I know I'm reading the right things, but setting doesn't seem to work. What am I missing?
mactastik is offline   Reply With Quote