Getting play counts (from e.g. mpd)

Just checking that the best/only way to get track play counts is with the metasync plugin?

I’d love to have playcounts from mpd (which metasync currently does not support).

Then I’m gonna write a script to make my email sig “Currently listening to [TOP WEEKLY ALBUM]” because yes I am just that narcissistic.

:smiley: You might also be interested in mpdstats:
https://beets.readthedocs.io/en/stable/plugins/mpdstats.html

2 Likes

I think beets is my favourite open source project ever :heart_eyes:

1 Like

I don’t suppose bpd updates play_count stats? Because that would be cool.

That would be cool! But no, I don’t believe it does any statistics collection.

My adventures with mpdstats are ramping up!

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 :sunglasses:

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.

1 Like

That is a very good idea.
Another day, another reason to properly learn python…