From d8f19cfde6b81fdd983c9bce28f3be7c1cab5c60 Mon Sep 17 00:00:00 2001 From: Siina Mashek Date: Sat, 24 Dec 2022 01:15:02 +0200 Subject: [PATCH] updating listento default player; adding whatmusic --- common/listento | 2 +- common/whatmusic | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100755 common/whatmusic diff --git a/common/listento b/common/listento index 76e94be..0447170 100755 --- a/common/listento +++ b/common/listento @@ -1,7 +1,7 @@ #!/bin/sh # Listenbrainz + DeaDBeeF (or others) via rescrobbled if [[ $# -eq 0 ]]; then - player="deadbeef" + player="audacious" else player="$1" fi diff --git a/common/whatmusic b/common/whatmusic new file mode 100755 index 0000000..ed49a75 --- /dev/null +++ b/common/whatmusic @@ -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