I am trying to read and write the star rating for files with KM and was surprised that it's not part of the file attributes action, because for me Tags & Ratings belong together
I am trying to do it through the command line now, but also hit a roadblock. I can read them with
but I have no idea how to write them, because xattr returns a bplist and needs one to set a new value. Obviously, the list is decoded with the code above, but I have no idea how to create a new one in order to set a new value.
Does anybody know how to do this and can supply a quick snippet?
Would this be a feature worthwhile implementing as an additional dropdown option for the "Get / Set File Attribute" macros?
Star Rating is one of the common metadata attribute keys, but you are right, Finder doesn't expose it. I could swear that it used to be part of the "more info" window in older MacOS versions, but I might be wrong.
It works across multiple applications. The ones I use the most are PathFinder and Leap, which is a Tag Browser. Spotlight also picks them up,
Unfortunately, I don't speak python But I saw the second link and gave it a try, but it doesn't work that way anymore. Even though you can pass a number to kMDItemStarRating and it even gets stored, the other apps don't pick it up.
It may be that different apps are using different metadata fields for the star ratings. Find/create a file that shows with 3 stars in all your different apps, then list the xattrs for that file to find what's been set.
Have a look at this Eclectic Light post for more about xattrs and some utilities that might help.