home/bin/nowPlaying.sh
2021-01-24 15:16:13 +01:00

12 lines
417 B
Bash
Executable file

#! /bin/bash
spotifyIsUp=`pidof spotify`
rhythmboxIsUp=`pidof rhythmbox`
if [ "${spotifyIsUp}" ]; then
echo $(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata | grep "^xesam:\(title\|artist\):" | grep -o " .*" | column | sed "s/\t\+/:/g")
elif [ "${rhythmboxIsUp}" ]; then
echo $(rhythmbox-client --print-playing-format "%ta - %tt (%at)")
else
echo ""
fi