Display “Now Playing” info on your Desktop with GeekTool or Ubersicht

I listen to Seattle’s KEXP streaming radio fairly regularly and even when I’m not I like to know what they’re playing. I use GeekTool to display KEXP’s “Now Playing” song on my Mac Desktop.

Note that this doesn’t work anymore. If you have a way that works then please let me know.

curl -silent 'http://kexp.org/playlist/miniplaylist' | perl -l -0777 -ne 'print $1 if /<title.*?>\s*(.*?)\s*<\/title/si' | perl -MHTML::Entities -le 'while(<>) {print decode_entities($_);}'

For Spotify, I have this script:

DATA=$(osascript -e 'tell application "System Events"
set myList to (name of every process)
end tell
if myList contains "Spotify" then
tell application "Spotify"
if player state is stopped then
set output to ""
else
set trackname to name of current track
set artistname to artist of current track
set albumname to album of current track
if player state is playing then
set output to trackname & " | " & artistname & " | " & albumname
else if player state is paused then
set output to ""
end if
end if
end tell
else
set output to ""
end if')
echo $DATA | awk -F new_line '{print $1}'
echo $DATA | awk -F new_line '{print $2}'

There are a few places within the code where you can customize what appears if Spotify is paused or stopped. I have those set to be empty. (“”)

Edit – 2019:

I am now using a different application called Ubersicht. For Spotify I use this code:

command: """
read -r running <<<"$(ps -ef | grep \"MacOS/Spotify\" | grep -v \"grep\" | wc -l)" &&
test $running != 0 &&
IFS='|' read -r theArtist theName <<<"$(osascript <<<'tell application "Spotify"
        set theTrack to current track
        set theArtist to artist of theTrack
        set theName to name of theTrack
        return theArtist & "|" & theName
    end tell')" &&
if [ -z "$theArtist" ]
then
    echo ""
else
    echo "$theArtist - $theName" || echo "Not Connected To Spotify"
fi
"""

refreshFrequency: 2000

style: """
  top: 1395px
  left: 2300px
  color: #fff

  .output
    font-family: Helvetica Neue
    font-size: 15px
    font-weight: 100
    text-shadow: 0 1px 5px #111;
"""

render: (output) -> """
	<div class="output">#{output}</div>
"""

I haven’t found a way, or taken the time to script it up myself, but if you have a way to use Ubersicht for KEXP then please let me know.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.