home/Bin/nowPlaying.sh

13 lines
417 B
Bash
Raw Normal View History

2020-08-12 19:38:17 +02:00
#! /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