I’ve got a script to get the current top album and output the string On high rotation: $albumartist - $album:
TOP_ALBUM="$(beet list rating:0.5.. -f '$rating $albumartist - $album' \
| awk 'BEGIN { FS="\t" } { a[$2] += $1 } END { OFS="\t"; for(i in a) print a[i], i }' \
| sort -nr | head -n1 | cut -f2)"
echo "On high rotation: $TOP_ALBUM"
This sums up each song rating for each album, sorts by the total ratings, cuts just the top, and then only the second field (omitting the total album rating).
I then have a script to recreate my email sig once a week with this at the bottom
The only thing is, if I play some 2-min pop song 5 times, and some 20-min ambient piece 5 times, they’re both gonna have the same rating, but I tend to think that listening to 100 mins of the ambient music should count more than 10 mins of the pop song.
I toyed around with outputting $rating $length $albumartist - $album but can’t really figure out how to multiply a rating x time in the format MM:SS…
Very cool! If I were you, I might try using an inline field or a custom plugin to define a field like $played_seconds. In both cases, you get access to the underlying Python values, which are just integers you can multiply—no need to parse the string, as you would in a shell script that parses the formatted beets output.