Sharing my trial and error learnings here in case it helps others in the future. I'll also share what I finally worked out to solve my issue in hopes it helps others and in case someone else has a better way.
I wanted to see music/file Ratings in MP3Tag. I'm currently using Strawberry Music Player (SMP is based on Clementine). I used iTunes for years, but one of the downsides is it didn't store ratings in ID tags. One of the things I like about SMP is it can store ratings and playcounts in tags and therefore those are maintained across devices, players and such.
I'm a long-time MP3Tag user, pretty versed in coding and tagging, but I found that (it seems) there are few if any standards for how ratings are handled. They can be stored in a number of different fields by different players and the values stored can vary widely too.
After lots of web searches, reading many MP3Tag community posts, help documentation as well as similar things on various MP3 player sites, Here's a few things I learned.
- Strawberry Music Player stores Rating values in the FMPS_Rating field.
- SMP supports 1-5 stars and allows half star ratings - it stores those values as numeric fractional values (e.g. 1 star = 0.2, 4 stars = 0.8, 5 stars = 1) Unrated = no value entered. Change a Rated song to no rating...the value in the tag field changes to "0".
- MP3Tag math functions only do integer math.
- MP3Tag MATH FUNCTIONS ONLY DO INTEGER MATH.
- MP3Tag MATH FUNCTIONS ONLY DO INTEGER MATH...no floating point math here.
- Using Math Functions like $num, $div, $mul, $add will IGNORE EVERTHING AFTERN THE DECIMAL POINT (e.g. $num will only return 1 or 0 if the values are all less than or equal to 1).
- The documentation for the arithmetic functions could make the "integer only" thing more visible and explain what it means (and make it easier to find when searching). If you're trying to work with decimals, you don't search for the word "integer". Also, people scan text and look at the description of $mul... Note also that the $num string function description says "It ignores anything from the first non-numeric character"...but it doesn't add that "." is considered "non-numeric" or that it will only return integers. Lots of numbers include a decimal point...
So, here's how I ultimately solved my challenge:
For tracks rated 1-5 stars with values stored as 0.2; 0.4; 0.6; 0.8, and 1:
$if($eql(%fmps_rating%,0.8),4,$if($eql(%fmps_rating%,0.6),3,$if($eql(%fmps_rating%,0.4),2,$if($eql(%fmps_rating%,0.2),1,$if($eql(%fmps_rating%,1),5,$if($eql(%fmps_rating%,),NULL, XXXXXXXX ))))))
For non-coders, this is basically a set of nested "if" statements looking for values like "0.8" and displaying the desired value (like "4" for 0.8). An empty value shows the string "NULL" and if any other value is seen, it shows "XXXXXXX".
Here's the final version I came up with that handles half-stars and a "0" for if the rating is overwritten to "less than a half star" (looking unrated in my player).
$if($eql(%fmps_rating%,0.8),4,$if($eql(%fmps_rating%,0.6),3,$if($eql(%fmps_rating%,0.4),2,$if($eql(%fmps_rating%,0.2),1,$if($eql(%fmps_rating%,1),5,$if($eql(%fmps_rating%,),NULL,$if($eql(%fmps_rating%,0.1),0.5,$if($eql(%fmps_rating%,0.3),1.5,$if($eql(%fmps_rating%,0.5),2.5,$if($eql(%fmps_rating%,0.7),3.5,$if($eql(%fmps_rating%,0.9),4.5,$if($eql(%fmps_rating%,0),0,ERROR))))))))))))
If your player doesn't use the fmps_rating field, it could use one of these fields:
- rating
- rating mm
- rating winamp
- rating wmp
- popularimeter
Hope that helps some folks. Also, +1 to the idea of MP3Tag (which has always been amazing) supporting ratings more simply.
Evidently I've also taken up novel writing for a very niche community of readers. Regards. ![]()