19 lines
432 B
Bash
Executable File
19 lines
432 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 "$artist" - "$track"
|
|
else
|
|
echo "Not listening to anything right now."
|
|
fi
|