Add script for playback status
[spot-check-nix.git] / spot_playing
1 #!/bin/sh
2 dbus-send --print-reply=literal --session \
3 --dest=org.mpris.MediaPlayer2.spotify \
4 /org/mpris/MediaPlayer2 \
5 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus' \
6 | awk 'END { if (NR == 0) { exit 1 } } { exit $2 != "Playing" }' # 0 (success exit code) means playing