local-bin/common/whatmusic

14 lines
354 B
Bash
Executable File

#!/bin/sh
api_url="https://api.listenbrainz.org/1/user/$1/playing-now"
if [[ ! $1 ]]; then 1="siinamonster"; fi
read artist track < <(echo $(curl -s $api_url | \
jq -r '.payload.listens[0].track_metadata | .artist_name, .track_name'))
if [[ "$artist" != "null" ]]; then
echo "$artist" - "$track"
else
echo "Not listening to anything right now."
fi