View Single Post
Old 01-06-2025, 08:47 PM   #2
mactastik
Junior Member
mactastik began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jan 2025
Device: none
Since it's not much longer, though this would benefit from a more complete test script:

Code:
# Run with calibre-debug -e calibre_filler.py
import calibre.library

LIBRARY = "calibre/andy"

calibre_db = calibre.library.db(LIBRARY).new_api

# calibre_books = get_calibre_books()
metadata = calibre_db.get_metadata(291)
stars = metadata.get_user_metadata("#stars", True)
stars["#value#"] = 7  # values are 0 to 10
read = metadata.get_user_metadata("#read", True)
read["#value#"] = True
print(f"   Update metadata from [{stars['#value#']}] [{read['#value#']}]")
metadata.set_user_metadata("#stars", stars)
metadata.set_user_metadata("#read", read)
It reads the values fine but doesn't store them in the database. Is there a "write" command of some kind I'm not aware of?
mactastik is offline   Reply With Quote