SOLVED.
The custom field is the key as follows:
- Add a custom column. I used a text column, limited to the values 0 - 5 (I called it "ratingcalc")
- Populate that column to match the rating. I'm on linux, so this was done with a 6-line shell script :-). One note - in my environment only "read" books have ratings, but not all read books have ratings. I only started adding the ratings a couple of years ago.
- Use the new text column in a prefix rule. This was done in my catalog generation shell script, but it also works fine in the GUI:
Code:
--prefix-rules="(\
('Rating','#ratingcalc','False',''),\
('Rating','#ratingcalc','5','5'),\
('Rating','#ratingcalc','4','4'),\
('Rating','#ratingcalc','3','3'),\
('Rating','#ratingcalc','2','2'),\
('Rating','#ratingcalc','1','1'),\
('Read books','#read','True','✓'),\
('Not Kobo','#to_kobo','False','×')\
)"
- Update the catalog script to also populate the new column for those books where the original rating field is populated.
The resulting EPUB catalog shows a check-mark as the prefix character for books that are "read" but have no rating, and a number for books that have a rating.
A few related notes:
- I tried using a few other column types with no success:
- Composite column based on the original ratings field ( using '{ratings:ratings_to_stars()}' )
- Integer column
- Ratings column
- The scripts update this field using 'calibredb set_metadata'. If you pass a value outside the field limits (<0 or >5 in my example), set_metadata succeeds (ie, returns 0), but leaves the field value unchanged
:-))
HTH!
Dan