How to live with Rhythmbox’s custom sorting feature

Rhythmbox has a feature which allows you to enter a custom sort name for tracks’ artist and album field. So for example, if I wanted tracks by The Knife to appear amongst the Ks in my library, I could specify the sort name “Knife, The” for those tracks. Same for albums.

This sounds like a nice feature, but I have a few issues with it.

  1. The feature is hidden in a tab of tracks’ properties window. I have used Rhythmbox for several years now, and after a rebuild of my rhythmdb.xml file a while ago, I had absolutely no idea why my tracks were suddenly sorted differently. After a few months of puzzlement and fruitless web searching about it, I finally came across a thread on Ubuntu Forums which helped me figure out what was going on.
  2. Automatically rebuilding the rhythmdb.xml file seems to result in inconsistent sort names. I did not specify any custom sort names, but Rhythmbox specified a lot for me. However, for some reason it was inconsistent with many tracks. Half of my albums from The Knife were artist-sort-named as “Knife, The”, while the rest had no sort names. I didn’t investigate why this occurs, but I noticed it seemed to be on the basis of albums; all tracks within any given album were artist-sort-named the same, but other albums from the same artist were often different.
  3. There’s no global on/off toggle for this feature. I wouldn’t mind this feature’s problems if I wasn’t forced to deal with it all the time. Disabling custom sorting altogether would be useful as I have no need for this feature.

These problems were all compounded by the fact that my library is about 125 GB and holds over 13,000 tracks. Rebuilding rhythmdb.xml takes ages.

I attempted to solve the inconsistent sorting issue by selecting the tracks with custom sort orders, going into properties for those tracks, and clearing the appropriate fields. This invariably resulted in one of two outcomes:

  • Rhythmbox apparently does nothing, or possibly reverts the change immediately. Upon checking properties again, the fields seem to be the same as before.
  • Rhythmbox appears save changes to rhythmdb.xml, but begins to do a ton of disk I/O, bringing everything to a crawl, and I am forced to kill the process. This occurred when I attempted to select and clear the fields for all of my tracks at once. When I started it again, it continued to thrash my disks, so I deleted the XML file and let it start fresh (I didn’t think to save a backup).

I eventually came up with a quick and dirty way to clear the fields from rhythmdb.xml using sed. Obviously you will want to quit Rhythmbox before doing this. (Mind the text wrapping…)

cd ~/.local/share/rhythmbox
sed 's/<mb-artistsortname>.*<\/mb-artistsortname>/<mb-artistsortname><\/mb-artistsortname>/g' rhythmdb.xml > rhythmdb2.xml

This will find and clear all instances of the artist sort name field which have something in them. I’m not sure what the field is for album sort order, but if you find that, you can alter the command to do the same for that field.

After this, you will want to check the new file (rhythmdb2.xml) to make sure the command did what it was supposed to. Then you can rename it to rhythmdb.xml, but I suggest you hold on to the original untouched rhythmdb.xml just in case Rhythmbox doesn’t like the new and improved one. (Restoring a backup is much less painful than rebuilding the file from scratch.)

Once I did this and re-opened Rhythmbox, I was pleased to see that MC Frontalot was no longer next to Sage Francis in my library. However, I’m a little anxious knowing that this inconsistent sort behavior will probably reoccur once I add new tracks to the library, as Rhythmbox will then make new entries for them. I could always run this command again, but I would prefer not having to do so.

This entry was posted in IRL Crap, Music. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Comment

  1. blindtiger
    Posted 4 Mar 2013 at 15:06 | Permalink

    Thanks. This helped my sorting situation also.

Post a Comment (comments are moderated and may not immediately appear)

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Recent Posts

  • Topics

  • Archives