The Rhythmbox UPnP plugin

For some time now there is an UPnP plugin based on Coherence for Rhythmbox.

It allows to access other MediaServers on the network and to export the Rhythmbox music collection to other UPnP MediaRenderers, for instance the Sony Playstation 3.
In newer versions even with nice device icons for visual identification.

A little video I made shows you the whole thing in action.

As of today (December 10,2007) you need for this:

  • Rhythmbox >= 0.11.2 or current trunk(Fedora 8 and rawhide seem to be up to date)
  • Coherence version 0.40 or higher

First we install Coherence. If you are lucky, it is already available in your distribution, so an apt-get install python-coherence might work.
On Fedora 8 or newer yum -y install rhythmbox-upnp should do the trick, the Coherence package there is python-Coherence, in case it doesn't get pulled in with the rhythmbox-upnp one.
More ways to get binary packages for your distribution are listed on the packages page.

If not we need to go the longer way and apt-get install python2.5 python-setuptools python-twisted-core python-twisted-web.
Follow that with an easy_install Coherence and you should be set.
If not you will probably find a solution in the Coherence Documentation Department.

Now on to Rhythmbox itself.

Either download the latest tar-ball or (probably better) go for svn - svn co http://svn.gnome.org/svn/rhythmbox/trunk rhythmbox.

Enter the newly created rhythmbox directory and issue the following commands as described here:

./autogen.sh
make

after that a rhythmbox binary should have been created.
You can install it with sudo make install to /usr/local/bin or just run in locally with shell/rhythmbox (or ./rhythmbox).

Eventually you need to install a current totem-pl-parser too.
But a simple download, unpack, ./configure, make and sudo make install is sufficient.

Start rhythmbox and activate UPnP sharing support at [Edit][Plugins].

If the Rhythmbox MediaServer doesn't show up at your UPnP client you should:

  • disable for a moment a firewall that protects your system
  • check with the selinux configuration
  • add a multicast route to your network configuration, using the interface your system is connected to the network:
    sudo route add -net 239.0.0.0 netmask 255.0.0.0 eth0
    

Ender's Notes (June 23, 2008)

With a lot of help, I just got Rhythmbox working with coherence. I'm using an Ampache/coherence setup for my server, and attempting to access the music from that server on my desktop. Before I got started, I got the whole thing working with my Roku Soundbridge M2000. That way, I knew that I had all of the backend working.

The first thing you should do is ensure that you have the proper versions of things. While the latest Ubuntu release of Rhythmbox for Hardy Heron (8.04) is good enough, the latest Ubuntu release of coherence (0.5.0) is NOT. Rhythmbox expects at least 0.5.2, and I'd suggest getting the latest release as it's relatively easy to install. Another important must-do when setting this up is to run rhythmbox from a console window so that you can see the output it produces. Here is what my (working) installation looks like when it starts up:

$ rhythmbox
WARN  coherence                   Jun 23 12:23:37  Coherence UPnP framework version 0.5.6 starting... (coherence/base.py:237)
WARN  webserver                   Jun 23 12:23:37  WebServer on port 56226 ready (coherence/base.py:106)
WARN  rb_media_renderer           Jun 23 12:23:38  __init__ RhythmboxPlayer {'shell': <rb.Shell object at 0x1124b90 (RBShell at 0x854040)>, 'no_thread_needed': True} (coherence/MediaPlayer.py:34)
WARN  rb_media_renderer           Jun 23 12:23:38  get_volume 1.0 (coherence/MediaPlayer.py:374)
WARN  rb_coherence_plugin         Jun 23 12:23:39  found upnp server Rhythmbox on 192.168.15.101 (uuid:21478b4f-3080-471b-b80f-2b0ade87e076) (coherence/__init__.py:145)
WARN  service_client              Jun 23 12:23:40  error requesting'http://192.168.15.1:80/http://192.168.15.1/upnp/Layer3Forwarding.xml' (coherence/upnp/core/service.py:275)
WARN  service_client              Jun 23 12:23:40  error requesting'http://192.168.15.1:80/http://192.168.15.1/upnp/WANCmmonIFConfig.xml' (coherence/upnp/core/service.py:275)
WARN  service_client              Jun 23 12:23:40  error requesting'http://192.168.15.1:80/http://192.168.15.1/upnp/WANEthernetLinkConfig.xml' (coherence/upnp/core/service.py:275)
WARN  service_client              Jun 23 12:23:40  error requesting'http://192.168.15.1:80/http://192.168.15.1/upnp/WANIPConnection.xml' (coherence/upnp/core/service.py:275)

You'll notice that in spite of some scary-looking error lines, I said it's working. And it is. Looking at my Rhythmbox window, I now have a new left-hand panel. Underneath my Library, Stores, and Playlists panels there's now 'Shared' with a single entry 'Ampache'. That's my server! Clicking on it brings up a list of songs being served by my server. Clicking on songs generally gets them to play, though things are extremely buggy and I can crash Rhythmbox without too much difficulty.

Of course, when you start you may encounter an ugly python stack trace error. Rhythmbox will still run, but your uPnP plugin has just crashed. This is a known problem, and there is already a newer, unreleased version of the Rhythmbox plugin that I got by going into the #coherence IRC channel on irc.freenode.net and talking to 'dev'. He has indicated that a newer plugin will be released soon - which is why the plugin I have has not been released yet.

Basically, the moral of this story is that you should never trust the Ubuntu repos, and that this plugin is far from finished and stable. If your uPnP plugin works, you will see the new Shared tab. If it does not, you won't. That sounds asinine, but I had no idea if it was working or not and if it was, if I had to do something to 'mount' the found music server. The answer is no to both of those.

Jonty's Notes (July 13th, 2008)

After following Ender's notes above, I was still left with a non-functioning rhythmbox UPNP plugin. I talked to Frank (Dev) in the IRC channel, and he recommended manually upgrading the rhythmbox plugin to the SVN version.

On Ubuntu, the plugin directory is: /usr/lib/rhythmbox/plugins/upnp_coherence, remove all the files EXCEPT the coherence.rb-plugin file, and replace them with:

http://coherence.beebits.net/browser/trunk/Coherence/misc/Rhythmbox%20Plugin/upnp_coherence/__init__.py?format=raw
http://coherence.beebits.net/browser/trunk/Coherence/misc/Rhythmbox%20Plugin/upnp_coherence/MediaPlayer.py?format=raw
http://coherence.beebits.net/browser/trunk/Coherence/misc/Rhythmbox%20Plugin/upnp_coherence/MediaStore.py?format=raw
http://coherence.beebits.net/browser/trunk/Coherence/misc/Rhythmbox%20Plugin/upnp_coherence/UpnpSource.py?format=raw

Obviously, rename them to the correct filenames (init.py, MediaPlayer?.py, MediaStore?.py, UpnpSource?.py).