Fixing gray stars in Apple Music (OS X)

Apple Music's rating system is (mostly) fairly obvious - you set a rating from 1 to 5 stars, or you can set it to no rating. The stars appear as outlines (or nothing) when they're not used, or white when they are.

However, I noticed recently that, for a few albums of mine, all the songs were displaying a rating in gray stars, despite those songs not being rated. Rating them and unrating them did nothing — the gray stars were still there.

Turns out Apple has a weird feature called "Album rating." I have no idea how you're actually supposed to set this (all the instructions I found online didn't work), but if your album has a rating and the individual songs don't, Music will automatically (the gray stars) assign a rating based on the album rating.

I still have no idea how I set the album rating in the first place. But, if you want to get rid of yours, open Music and select the offending files. Then, open Script Editor, paste this in, and run it:

tell application "Music"
	if selection is not {} then
		set mySelection to selection
		repeat with aTrack in mySelection
			set album rating of aTrack to 0
		end repeat
	end if
end tell