I've been confused by this discussion regarding the Rating metadata 
myself.  I've done a lot of programming using the excellent exiftool  
(https://exiftool.org/) to create useful utilities to manage my picture 
file metadata.  When I tried to extend into the realm of mp3s I also had 
trouble finding where the rating data was.  What I discovered was that it 
was being stored obtusely under the meta tag "Popularimeter".  Here is what 
I do to extract the rating value.

First, here is what the raw metadata looks like.  The specific content 
varies depending upon how it was stored by the program where the rating 
assignment was made.

Here is an example from an early file where Windows Media Player made the 
assignment:

# exiftool -Popularimeter  *.mp3
Popularimeter                   : Windows Media Player 9 Series Rating=192 
Count=0

Here is the content from a file rated with Clementine:

# exiftool -Popularimeter  *.mp3
Popularimeter                   :  Rating=192 Count=0


I extract just the rating value in my program using:

POP=$(exiftool -Popularimeter "${FILE}" |  perl -pe 
's/^.*Rating=([0-9]*).*$/\1/')

Of course there are many ways to get this job done.  I'm using ksh and perl 
here.

I then convert this to a simple integer, formatted for my output needs:

if [[ -z "${POP}" ]] ; then
    RATING=""
 elif [[ ${POP} -ge 255 ]] ; then
    RATING="Rating      : 5"
 elif [[ ${POP} -ge 192 ]] ; then
    RATING="Rating      : 4"
elif [[ ${POP} -ge 128 ]] ; then
    RATING="Rating      : 3"
elif [[ ${POP} -ge 64 ]] ; then
    RATING="Rating      : 2"
else
    RATING="Rating      : 1"
fi

I hope this helps.






-- 
You received this message because you are subscribed to the Google Groups 
"Clementine Music Player" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clementine-player/c8da2b6d-1b8c-49f4-816b-16f39133b0d8o%40googlegroups.com.

Reply via email to