If like me you enjoy listening to music the most when consuming full albums, then you must have this urge to just launch a new random album from your library.
Here is a little script that does just that for Deezer and runs just fine on WSL and Linux desktops:
# replace the user ID with your user ID (or keep this one to get a favorite album of mine :-) )
user="00";
# get the total number of favorite albums
total=$(curl -s -k https://api.deezer.com/user/${user}/albums?index=0\&limit=1 | jq -r '.total');
RANDOM=$$
# pick a random one. I use the $RANDOM shell builtin to avoid external dependencies (it was python before this change)
# data=$(curl -s -k "https://api.deezer.com/user/${user}/albums?index=$(($total*$RANDOM/32768))&limit=1");
# echo $data;
# link = $(echo $data | jq -r '.data[0] | (.link)');
# index=$jk
link=$(curl -s -k "https://api.deezer.com/user/${user}/albums?index=$(($total*$RANDOM/32768))&limit=1" | jq -r '.data[0].link');
# nicename=$(curl -s -k "https://api.deezer.com/user/${user}/albums?index=$(($total*$RANDOM/32768))&limit=1" | jq -r '.data[0] | "\n\(.title) - \(.artist.name)\n\(.link)\n"');
# real linux
# xdg-open $link
# wsl
wslview $link
Now, it’d be even better if we had a way to play full albums on shuffle (listen to full album 1 then jump to full album 2)…