Get suggestions for a next song with songmem!

Cool stuff you can do with MPD. A place for you to put your hacks and patches, or be inspired by others'.
Post Reply
codesoap
Posts: 1
Joined: November 16th, 2019, 9:02 am

Get suggestions for a next song with songmem!

Post by codesoap » November 16th, 2019, 12:40 pm

Often I don't listen to whole albums, but skip around my library. I found it annoying to always think about the next song to play and made an effort to automate this process by recording my listening patterns and generating suggestions.

The result of my efforts is a tool I call songmem. You can use it to record what songs you are listening to like this:

Code: Select all

while true
do
	song="$(mpc -f '%artist% - %title%' current --wait)"
	songmem --register "$song"
done
After you recorded your listening patterns for a while you can list your recently heard songs with songmem and get suggestions for a song with songmem --suggestions 'LORN - ACID RAIN'. This is, of course, way to annoying to type and use, so you should get the song's name you want suggestions for from songmem itself like this:

Code: Select all

songmem --suggestions "$(songmem | dmenu -l 16)" | dmenu -l 16
.

You could then use mpc to add the selected suggestion to your queue. Take a look at my scripts on GitHub for a more advanced example.

I hope you find the little tool useful.

Greetings,
codesoap

Post Reply