WOOT!

May 10, 2007 15:51

WOOT!

I have found the perfect (well, almost) music player!

And I was able to tie it into LogJam (my LJ client). That means I don’t have to type the name of whatever it is that I am listening to anymore!

YAY! :-)

It is easy to work with, attractive, does things The Right Way (e.g., you can click the close window button and it goes down to the system tray-EXACTLY what it should do; Rhythmbox made you click the tray to minimize the window to that spot, if you closed it, then it quit the application), has a wide pre-entered selection of Internet Radio stations (have you contacted your Representative yet about that?), and is easily scriptable. It only took me a couple of minutes to write the script to interface with LogJam so that LogJam can automatically collect the music information:


#!/bin/bash
#
# Detect music from Banshee for LogJam
# © 2007 Michael B. Trausch
#

pgrep banshee > /dev/null 2> /dev/null
if [ "$?" = 1 ]; then
printf "No music (Player not running)"
exit
fi

PLAYING=`banshee --query-status`

if [ "$PLAYING" = "Status: 1" ]; then
CURR_MUSIC=`banshee --query-artist --query-title --query-uri`

CURR_TITLE=`echo "${CURR_MUSIC}" | grep '^Title: ' | sed 's/Title: //g;'`
CURR_ARTIST=`echo "${CURR_MUSIC}" | grep '^Artist: ' | sed 's/Artist: //g;'`

#
# Now, we need to detect whether or not we're listening to
# Internet Radio or not...
#

PLAYBACK_SOURCE=`echo "${CURR_MUSIC}" | grep '^Uri: ' | sed 's/Uri: //g;'`
PLAYBACK_SOURCE_TYPE=`echo "${PLAYBACK_SOURCE}" | cut -f1 -d:`

if [ "$PLAYBACK_SOURCE_TYPE" = "file" ]; then
printf "[Local Playlist] %s - %s\n" "$CURR_ARTIST" "$CURR_TITLE"
else
printf "[%s] %s\n" "$CURR_ARTIST" "$CURR_TITLE"
fi
else
printf "No music (Not playing)"
fi

This makes me happy!

unix, music

Previous post Next post
Up