2022-12-24 01:15:02 +02:00
|
|
|
#!/bin/sh
|
2023-03-11 22:14:15 +02:00
|
|
|
if [[ ! $1 ]]; then
|
|
|
|
user="siinamonster"
|
|
|
|
else
|
|
|
|
user="$1"
|
|
|
|
fi
|
2022-12-24 01:15:02 +02:00
|
|
|
|
2023-03-11 22:14:15 +02:00
|
|
|
api_url="https://api.listenbrainz.org/1/user/$user/playing-now"
|
2022-12-24 01:15:02 +02:00
|
|
|
|
2023-03-11 22:14:15 +02:00
|
|
|
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 '"')
|
2022-12-24 01:15:02 +02:00
|
|
|
|
|
|
|
if [[ "$artist" != "null" ]]; then
|
2024-04-22 06:06:10 +03:00
|
|
|
echo "Currently playing: $artist" - "$track"
|
2022-12-24 01:15:02 +02:00
|
|
|
else
|
|
|
|
echo "Not listening to anything right now."
|
|
|
|
fi
|