grab what current song is playing
This commit is contained in:
parent
a6ebcf95f0
commit
2e56222e29
1 changed files with 9 additions and 4 deletions
|
@ -1,10 +1,15 @@
|
|||
#!/bin/sh
|
||||
api_url="https://api.listenbrainz.org/1/user/$1/playing-now"
|
||||
if [[ ! $1 ]]; then
|
||||
user="siinamonster"
|
||||
else
|
||||
user="$1"
|
||||
fi
|
||||
|
||||
if [[ ! $1 ]]; then 1="siinamonster"; fi
|
||||
api_url="https://api.listenbrainz.org/1/user/$user/playing-now"
|
||||
|
||||
read artist track < <(echo $(curl -s $api_url | \
|
||||
jq -r '.payload.listens[0].track_metadata | .artist_name, .track_name'))
|
||||
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"
|
||||
|
|
Loading…
Reference in a new issue