Updating song to emit song title or N/A
This commit is contained in:
parent
2ee093137b
commit
f4fa10b575
10
common/song
10
common/song
|
@ -1,8 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
player="spotifyd"
|
||||
qdbus org.mpris.MediaPlayer2.$player /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata >/tmp/currentsong
|
||||
player="spotify"
|
||||
qdbus org.mpris.MediaPlayer2.$player /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata >/tmp/currentsong 2> /dev/null
|
||||
artist=$(cat /tmp/currentsong | grep "xesam:artist" | sed 's/.*artist: //')
|
||||
title=$(cat /tmp/currentsong | grep "xesam:title" | sed 's/.*title: //')
|
||||
|
||||
echo ${artist} - ${title}
|
||||
if [ "${artist}" != "" ] && [ "${title}" != "" ]; then
|
||||
echo ${artist} - ${title}
|
||||
else
|
||||
echo "N/A"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue