From f4fa10b5751182f44d01eb31757aa93829268e8f Mon Sep 17 00:00:00 2001 From: Siina Mashek Date: Thu, 8 Apr 2021 11:26:27 +0300 Subject: [PATCH] Updating song to emit song title or N/A --- common/song | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/common/song b/common/song index 17abb51..28aea37 100755 --- a/common/song +++ b/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