Skip to content

Instantly share code, notes, and snippets.

@joaomoreno
Created September 13, 2018 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joaomoreno/4ba133a4a03535042b509c2f094e5bdd to your computer and use it in GitHub Desktop.
Save joaomoreno/4ba133a4a03535042b509c2f094e5bdd to your computer and use it in GitHub Desktop.
Radiotray-NG Now Playing Script
#!/bin/sh
META=`dbus-send --print-reply --dest=com.github.radiotray_ng /com/github/radiotray_ng com.github.radiotray_ng.get_player_state 2> /dev/null`
STATUS=$(echo $META | sed 's/^.*"state"\s*:\s*"\([^"]*\)".*$/\1/')
if [[ "$STATUS" == "playing" ]]; then
ARTIST=$(echo $META | sed 's/^.*"artist"\s*:\s*"\([^"]*\)".*$/\1/')
TITLE=$(echo $META | sed 's/^.*"title"\s*:\s*"\([^"]*\)".*$/\1/')
echo "$ARTIST - $TITLE"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment