This past week I purchased for myself a mini laptop. I wanted something nice and portable that I could use for personal use on trips and do hobby projects on. This thing is great. I got Ubuntu installed and started playing around since it’s been a couple years since I had a Linux desktop, and even then I usually had a Mac OS X laptop I used with it. As such, when it came to copy over my music and such, I needed to convert to a new music player. I’ve settled on Banshee for the moment.
Problem: There’s no import tool out there to go from iTunes to the current version of Banshee.
Solution: However, the process turned out to be not so hard for me. Here’s what I did:
- Copied the iTunes music folder from my Mac to the music folder on my new laptop.
- Started up Banshee and used Media > Import Media… to tell Banshee where to find all the files and let it do it’s thing.
- Went back into iTunes on my old machine and used File > Library > Export Library… to generate a
Library.xmlfile, which I copied to the new laptop
- Ran a Perl script I wrote to pull out the play lists, song play counts, last play date, and ratings and push them into the Banshee database
Library.xml file output by iTunes is in a standard format that is pretty easy to understand. Also, Banshee keeps much of the information about your music and such in a SQLite database. So, I could very easily automatically copy over all the ratings and other information I’ve been assembling for the past several years.
Here’s the conversion script,
itunes-to-banshee.pl that I wrote for download:
Update (thanks to Rolo): You will need to install a few dependencies as well. On Debian or Ubuntu, this is done by installing:
This can be done from Synaptics or by running this on the command-line:
sudo apt-get install libdatetime-perl libdatetime-format-iso8601-perl \ libclass-dbi-sqlite-perl libxml-twig-perl libmime-base64-perl
Once Banshee has finished adding your song files to its music library, close Banshee. Make a backup copy of
banshee.db to somewhere in case something goes wrong (which can be found at
~/.config/banshee-1/banshee.db). Then run:
perl itunes-to-banshee.pl Library.xml ~/.config/banshee-1/banshee.db
This may take a few minutes, depending on how many songs you have. It might show you some warnings if your
Library.xml is weird (remember I wrote this just for me). It may also tell you if it can’t find some songs in Banshee that it found in your
Library.xml. (It did for me because I’d deleted some songs from the disk and iTunes never figured it out.)
Once it finishes, start Banshee back up and it should have the play lists, ratings, play counts, and last played date set for all the songs that had such information in iTunes.
There are a couple things you might want to know about how the program works. First, it does not touch smart play lists. I don’t know and don’t particularly care how to read the smart playlist configuration from iTunes. I was able to recreate the smart play lists I had in a few minutes.
Second, the import script uses the song title and song file size to match songs from the iTunes library in the Banshee library. This is probably safe since I’ve never seen two CDs with the same songs on them end up being the same size, but it’s theoretically possible it could be a problem.
Third, if you have duplicates in your library, this script will only change one of them. I’d recommend weeding those out first.
I’m not interested in maintaining the script, but I’ll answer questions about it. If you ask really nicely and I’m in a good mood and the change you want is very small, I might be willing to make it, but that’s a lot of “ifs” to line up.