Banshee and remote irssi

Ever since I switched to Banshee I've been a bit annoyed that I didn't know how to annoy others by advertising my currently playing song. I always knew the trick for Amarok which Theory posted a long while ago, but had no idea how to adapt this for dbus which Banshee uses. Now, thanks to kees, this has all changed.

In order to get at your currently playing song on Banshee from a SSH connection into your box, just run the following script:

#!/bin/bash

PID=$(pidof mono /usr/lib/banshee-1/Banshee.exe)

if [ -z $PID ]; then
    echo "Banshee doesn't appear to be running"
else
    export DBUS_SESSION_BUS_ADDRESS=\\
        \$(cat /proc/\$PID/environ | xargs -0 -n1 \\
            | grep ^DBUS_SESSION_BUS_ADDRESS= | cut -d= -f2-)
    banshee-1 --query-artist --query-title | cut -d ' ' -f 1 --complement | \\
        sed -n '1h;2,$H;${g;s/\n/ - /g;p}'
fi

It will produce output like so:

laney@chicken:~$ banshee-np.sh
Rancid – Corazon de Oro

Now to get it working remotely, just follow Theory's instructions, replacing

command="dcop --user `whoami` amarok player nowPlaying"

with

command="/path/to/banshee-np.sh"

and you should be good to go!

This post brought to you by my burnt hand, which I have to return to the ice pack every 20 seconds or so. Ouch.

Tags: , , ,

Leave a Reply