Wednesday 13 April 2011

Rhythmbox Artist Prefix Plugin

I've recently started using the Rhythmbox music player.  It seems pretty simple to use and like other Gnome applications is actually quite powerful under the covers but hides a lot of the power from basic use.  You sometimes have to dig a little to find a feature you're looking for.  That said, with no amount of digging was I able to find a feature to enable artists to be sorted while ignoring certain prefixes.  This is a pretty bulk standard feature of most music players and allows artists such as "The Beatles" to be sorted under "B" for Beatles rather than "T" for The.  There's quite a lot of discussion to be found on this in various Rhythmbox bug reports and on the mailing list.  The view of the developers is that it's not possible to automatically provide a one size fits all solution so they implemented the ability to allow users to manually add a sort tag to each track.

I've just written a first versions of a plugin I'm calling Rhythmbox Artist Prefix which allows the user to choose whether to have Rhythmbox attempt to automatically sort artists ignoring certain artist prefixes.  If you use Rhythmbox then give it a try!

The plugin works by querying the Rhythmbox database for artists with the given prefixes and that don't currently have a sort order defined (which allows the user to manually override the sort order derived by the plugin).  So long as the plugin is active it will watch the database for changes too.  The first time you run the plugin it will automatically add an entry to the sort order of all tracks returned by the query and if you leave it running then any time Rhythmbox finds new tracks matching the query their sort order will be updated as well.  Whenever the plugin is notified of a track by an artist such as "The Beatles" and that track doesn't already have a sort order, it will chop off "The" from the artist name and add the remainder (in this case "Beatles") to the artist sort order property for that track.  Quite simple really and I'm amazed it hasn't been done before.

4 comments:

Unknown said...

Hello,
Can you help me install your artistprefix plugin for Rhythmbox?
I am trying to follow your installation instructions and I am having trouble with the final step of unpacking the code into the plugin directory.
Adam

Graham White said...

Adam, sure. Send me an email with what you've tried and the version of Rhythmbox you're using and I'll see if I can help. (The obfuscate email address is available at the bottom of the page.)

thatbrod said...

Hello! I realize this is a very old plugin, but I'd really love to get this working in Rhythmbox 3.2.1

Would you mind giving me a hand?

Graham White said...

Hi, it's been a very long time since I last looked at this and did anything with the plugin. I have since moved from Gnome to KDE and now to XFCE so there's some chance I might start using Rhythmbox again I guess. However, I've no intention of using it at the moment and hence I'm unlikely to find the time to do anything with the plugin. I have, however, moved the code away from Google Code (the service was shut down) and you can now find it at https://github.com/grahamwhiteuk/artistprefix. If I recall correctly the plugin API changed for Rhythmbox 3 so it will need some work to understand what needs to be updated in this plugin - it may be just as easy to start from scratch? I think there was a doc somewhere that explained the API changes so you could start there and see if it's worth updating.