Banshee, Its Library, and Importing Playlists

I have been preparing myself for the move from Rhythmbox to Banshee as the default media library application in future versions of Ubuntu.  I have encountered some interesting peculiarities and I thought I’d talk a bit about them here for your benefit.

One significant change from Rhythmbox to Banshee is the way playlists and the library itself are managed.  Rhythmbox, bless its little heart, uses a simple XML file for the library and another for all the playlists combined.  Banshee by contrast makes use of SQLite to house all this information.

XML is particularly easy to manipulate using a basic text editor.  I’m no database administrator, so it will take me some time to get up to speed in making the SQL queries and changes I might want to make.  There is one functionality I was able to work through, however, and that is migrating playlists.

(In the end I abandoned importing my playlists and am looking into alternative solutions.  Reason is Banshee eventually either emptied every playlist (what?) or shifted the playlist contents to a neighboring playlist (double-what?) so that I couldn’t trust Banshee to store a playlist in any useful way.)

In order to move playlists from Rhythmbox to Banshee I first exported the playlists individually (I exported them as .pls files).  That was simple enough.  Here is a quirk though.  Rhythmbox marks the file paths for playlists in the format [library root]/path/to/file.flac.  In my case, since the library was located in ~/Music and since Music contained a link to my server share with all the music the path looked something like this:

Music/[share]/path/to/file.flac

Banshee, using the same setup and for reasons I have yet to determine, decided that all of the file locations were not at ~/Music/[share]/ but instead were located at /media/[share]/ (the mount point to which the shortcut in Music was aimed).

If I imported the playlist(s) as exported Banshee would get all confused about file locations and paths and I would end up with a bunch of duplicate entries where one used the ~/Music designation and the other used the /media designation.  It was rampant and bizarre and spilled beyond the borders of the imported playlists to files never mentioned in any playlist (though it did not infect the entire library).  Very odd; very frustrating.

It did not end there though.  The playlists would eventually empty.  All of the tracks listed in the playlist would, over some seemingly random period or through some as yet undetermined set of events, become devoid of tracks until each playlist would contain zero tracks.  The files were still in the collection; however, the mis-pathed files or duplicate files would be purged from the library.

I finally manipulated the playlist files (the .pls files) themselves using GEdit.  (Any text editor with a find and replace feature will do nicely.)  I changed every occurrence of Music/ to /media/ and this made all the difference.  The path duplication problem was gone since all the file paths were pointing to the /media/ location. I am confident this fixes this issue.

I have no idea why Banshee parses the link into its destination path (parses the relative path into an absolute path?).  I can’t think of another case where an application changes /path/to/link/ into /destination/of/link all on its own.  This may be expected behavior for Banshee (and by all measures seems to be), but I don’t understand it at present.

At any rate, this article ought to help anyone trying to migrate from Rhythmbox to Banshee at least get their playlists migrated over, and it ought to help understand some unique behavior in this new default media application.

I suppose I should take a moment to mention why Rhythmbox saves playlists with Music/ as the path root.  It seems that when you save a playlist Rhythmbox changes the file paths from what is used in the playlist.xml file which stores all playlist data (in my case: file:///home/[username]/Music/[share]/…) into a home-directory relative path (in my case: Music/[share]/…).  My guess is this is done to make the playlist available to anyone in a similar situation as the user who created the playlist (.pls) file—that user would run the .pls file from their own home directory and all would be well enough.

Again, you may or may not find this useful.  For my part I know I’d rather not have to rediscover it.

Oh there is one more important thing about importing playlists I should mention.  When you import the playlist it will be ordered by something-of-which-I-remain-uncertain.  It’s probably ordered by a field I don’t view.  Anyway, to get the playlist to sort by the playlist order (that is to say the order you created for that playlist) thrice click on any of the view column headers to first sort by that view, then reverse sort by that view, then finally to turn off view-by-column sorting for the playlist.

I created some related posts on the Ubuntu forums (here and here) as I was working through these matters.

Let me know if you have anything to add.

Happy hunting.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *