18 lines
451 B
Bash
Executable file
18 lines
451 B
Bash
Executable file
#!/bin/sh
|
|
if [[ ! $1 ]]; then
|
|
user="siinamonster"
|
|
else
|
|
user="$1"
|
|
fi
|
|
|
|
api_url="https://api.listenbrainz.org/1/user/$user/playing-now"
|
|
|
|
data=$(curl -s $api_url | jq -r '.payload.listens[0].track_metadata')
|
|
artist=$(echo "$data" | jq '.artist_name' | tr -d '"')
|
|
track=$(echo "$data" | jq '.track_name' | tr -d '"')
|
|
|
|
if [[ "$artist" != "null" ]]; then
|
|
echo "Currently playing: $artist" - "$track"
|
|
else
|
|
echo "Not listening to anything right now."
|
|
fi
|