Column Script to Show POPM Ratings as "Stars"

UPDATE: As of v. 2.48c, Mp3Tag added the field %rating winamp% for MP3 files, which means that the %popularimeter% field no longer works on the tag panel. Therefore, I have modifed my script as follows to work with all POPM formats in v. 2.48c:

With line breaks added for clarity:

$if(%rating winamp%,$repeat($char(10032),%rating winamp%),

$if(%rating wmp%,$repeat($char(9733),%rating wmp%),
$if(%rating mm%,$repeat($char(10026),%rating mm%),$repeat($char(10061),
$if2($ifgreater($regexp(%popularimeter%,'^.+|(\d{1,3})|\d+',$1),196,5,
$ifgreater($regexp(%popularimeter%,'^.+|(\d{1,3})|\d+',$1),128,4,
$ifgreater($regexp(%popularimeter%,'^.+|(\d{1,3})|\d+',$1),64,3,
$ifgreater($regexp(%popularimeter%,'^.+|(\d{1,2})|\d+',$1),1,2,
$ifgreater($regexp(%popularimeter%,'^.+|(\d)|\d+',$1),0,1,))))),0)))))

Without line breaks:

$if(%rating winamp%,$repeat($char(10032),%rating winamp%),$if(%rating wmp%,$repeat($char(9733),%rating wmp%),$if(%rating mm%,$repeat($char(10026),%rating mm%),$repeat($char(10061),$if2($ifgreater($regexp(%popularimeter%,'^.+\|(\d{1,3})\|\d+',$1),196,5,$ifgreater($regexp(%popularimeter%,'^.+\|(\d{1,3})\|\d+',$1),128,4,$ifgreater($regexp(%popularimeter%,'^.+\|(\d{1,3})\|\d+',$1),64,3,$ifgreater($regexp(%popularimeter%,'^.+\|(\d{1,2})\|\d+',$1),1,2,$ifgreater($regexp(%popularimeter%,'^.+\|(\d)\|\d+',$1),0,1,))))),0)))))

Four different Unicode glyphs are used to distinguish the rating source. These work for me on Vista but may not be available on all versions of Windows. Of course, you can use different characters.

Sorting by the ratings column is a bit slow with such a long script. The sort is not always as expected but within each of the four types, sorting works fine. In the Customize columns dialog, I do not use the Numeric option and I sort on field %rating winamp%. That puts all Winamp ratings at the top of a descending sort.

Thanks to Dano, DetlevD, and the others here who have tutored me on scripting!

Doug Mackie