13 lines
411 B
Bash
Executable File
13 lines
411 B
Bash
Executable File
#!/bin/sh
|
|
|
|
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: //')
|
|
|
|
if [ "${artist}" != "" ] && [ "${title}" != "" ]; then
|
|
echo ${artist} - ${title}
|
|
else
|
|
echo "N/A"
|
|
fi
|