updating listento default player; adding whatmusic

This commit is contained in:
Siina Mashek 2022-12-24 01:15:02 +02:00
parent 655f929f76
commit d8f19cfde6
2 changed files with 14 additions and 1 deletions

View file

@ -1,7 +1,7 @@
#!/bin/sh
# Listenbrainz + DeaDBeeF (or others) via rescrobbled
if [[ $# -eq 0 ]]; then
player="deadbeef"
player="audacious"
else
player="$1"
fi

13
common/whatmusic Executable file
View file

@ -0,0 +1,13 @@
#!/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