Google's Talk used to be my favorite IM cleint. Such a shame that it hasn't been updated in years, moreover it never got released for Linux. My favorite feature in GoogleTalk was the "now playing" plugin. Though there is a host of IM clients that work with gmail on Linux, and some even have the media plugins like google talk, but I never really got a hang of any one of those.

That was my motivation. I wanted to use shell to detect the currently playing media, and then to be able to do all sort of things with it. For example, this website (used to) displays the music I've been listening to, data for which comes from this simple script. The ps command gives the process status of all running applications; grep to filter the results to find if the music app is playing. This could be anything, like Banshee, Amarok, Clementine, VLC etc. If a active music app process is detected, then the script finds the open media file with lsof. For mp3 files, it is very simple to use id3info to read all the tag data.

I ran this script as a CRON job to scan the playing media. I would imagine that it would be a better idea to daemonize, but since the scirpt is so simple, I see no harm in CRON either, as long as it gets the job done.

View the gist on GitHub here.