I am quite excited as I have just managed to do what has been preventing me from completely switching to Ubuntu for a long time: import my iTunes library without losing my precious ratings and playcounts – a very time-consuming activity but extremely rewarding.
In this little tutorial I’ll be outlining the 6 steps I followed in order to achieve the above result. I’ll try to be as clear as possible in order for all audiences to repeat the process successfully. Let’s get started… You should achieve this in about 10min maximum.
1. First thing you need to do is to copy the “iTunes Music Library.xml” to your Linux partition and rename it in order to remove the spaces and make the path as simple as possible and as little error prone as possible. This file is used by iTunes to store all your library’s information and is usually located in a place like /My documents/My music/iTunes/. I for example placed mine in /home/nathan/itunes.xml. Make sure you have access to the path of this file as you will need it soon…
2. Rhythmbox uses a similar technique for storing your library’s information. You just need to locate this file on your disk. To do this, launch the terminal and type in locate rhythmdb.xml. This will output a line which should look like /home/nathan/.gnome2/rhythmbox/rhythmdb.xml – Like earlier, make sure you have access to this path as you will need it soon…
3. Make a backup of the above file by using the terminal command cp rhythmdb.xml rhythmdb.xml.bk – check that the file has been copied by doing a small ls.
4. Now you need to download a little script developed by Bowen Dwelle which I found via this blog post. You can find this script there. Unzip it in a place easily accessible. I for example placed it in /home/nathan/downloads.
5. You are just a few steps away from having your iTunes ratings and playcounts in Rhythmbox! Now open a terminal window and go inside the directory where the file you have downloaded and unzipped is located. Now you will need to run this script using the paths that we got earlier on by typing in the following command: perl transferratings.pl [path/to/itunes.xml] [path/to/rhythmboxdb.xml] – In my case I typed in perl transferratings.pl /home/nathan/itunes.xml /home/nathan/.gnome2/rhythmbox/rhythmdb.xml - if perl isn’t installed a simple sudo apt-get install perl will do the job.
6. The script will now output a couple of lines and tell you when it is finished. It took about 10 seconds on my laptop… Open Rhythmbox and you should now see your library updated with ratings and playcounts! Note that if you have purchased songs from the iTunes Music Store, these will of course not appear in the library.
Note that I did not write this perl script for importing your iTunes Library into Rhythmbox. If you need support I would suggest you to contact the developer of the script directly.
Hope this will help a few!



Tried the above but got lots of lines saying “Illegal octal digit ’8′ at /home/house2/Desktop/itunes.xml line 131, at end of line” and a final message saying “itunes.xml has too many errors”
Hi John!
Thanks for leaving your feedback! I’m sorry the script couldn’t help you… Seems to me like the itunes.xml is broken.
Have you tried validating the XML file over there? http://www.w3.org/2001/03/webdata/xsv – That could maybe give you some indication if the file is actually usable or not.
Maybe a clean install of iTunes could help too (don’t forget to export your library first so that you can re-import it with the clean install)…
Hope this helps!
Note: the python script fails if the rhythmbox db file doesn’t have ratings for each song already. Once I added a rating of 1 to each song, then re-ran the script, my ratings xfer’d over from iTunes.
Thanks Mike for your feedback. I must say I cannot confirm this as none of the songs I had in my library had ratings before I ran the script.
Still, I’m glad it worked for you and thanks again for sharing your feedback with us!
This is great! Thanks a lot for this description. But you missed to type the name of the Perl script itself :D I first did not recognize and started Perl with the xml files as parameters and it threw a lot of errors. But when I started the script with the xml files it worked fine :)
Hi Chris!
Thx for the feedback, I edited the post now.
Glad it helped!
Nathan.
Thanks Works very well in ubuntu jaunty, only change a few of lines in the script.
hey i can’t get this to work on the ubuntu jaunty because the paths are different are think. ‘B3to’ can you tell me please what changes you did?? or email me at rish000@hotmail.com! id greatly appreciate it !
Hey
Cheers for the excellent how-to. I’ve been looking for something that would enable me to do just this.
My only problem is… while running the Python script, I get the following error: Ran out of memory for input buffer at /usr/lib/perl5/XML/Parser/Expat.pm line 469.
My itunes.xml file is 7.5 megabytes – I guess this is too much for my setup of Python to handle? I’m sure there’s a config setting that I can tweak to get it working, but to be honest I’m not too fussed in the end.
It’s a shame though, because it looked like a pretty neat way of doing things.
I’m running Ubuntu 9.10 in case you were wondering.
Cheers for the article anyway.
Oliver
I followed the tutorial and I still have no ratings s= I’m desperate it’ll take me a life to rate each song again, I’m about to give up, if I rate them again will I be able to retain the ratings this time If I decide to move to another player? I followed the tutorial and the code backed up the library and supposedly updated the ratings I mean everything seemed to be right, I mean I didn’t mess up but the ratings still not show DAMN
btw I tried both the perl script and didn’t work, replaced the xml with the back up and tried again with the python script which didn’t work either
I ran the Perl script against my rhythmdb.xml and it almost worked perfectly. The only issue I had was that the dates ended up being 1934-1939 instead of 2004-2009. I don’t know Perl, so I didn’t look into it.
One thing I had to do was make sure the path of the songs in my iTunes xml file was the same as the Rhythmbox xml file. I was switching from OS X to linux, so the volumes/DRIVENAME needed to be media/DRIVENAME (at least on Arch Linux). I just used vim to do a search and replace.
You’re the king.
Proven on:
-Ubuntu 4.10 LTS
-Rhythmbox 0.12.8
-iItunes.xml with 30.000 files…(:
Great tutorial! One issue I had was that I assumed the script would also import the iTunes files into the Rhythmbox library. Not so. You have to import the iTunes music folder (from the Windows partition) into Rhythmbox first, exit, and then run the script. Also, for those looking for a better “iTunes” like experience in Linux can use Songbird. It is essentially a clone of iTunes and will import an iTunes library with ID3 Tags including ratings.
DUDE!! you rock!! it still works! i’ve just started using ubuntu. and i thought with all these new versions it just might not work.
rhythmbox 0.13.1
ubuntu 10.10
of course, it was tough for a newbie like me.
for ppl having problems – this is how i accomplished it.
location of rhythmdb.xml had been changed to home/.local/share/rhythmbox/
didn’t even knew how to open a terminal and change directory and on top of it’s case sensitive.
to open terminal ctrl+alt+f1
to change directory = cd path
first of all : import all the songs to your rhythmbox.
then edit itunes music library : find and replace “localhost/D:” with “media or something” and if you have songs in host then replace “localhost/c:” with host. you can look up in the rhythmdb.xml – how it specifies the path. and just make itunes.xml to look like that.
and then finally run perl transferratings.pl (blah blah blah)
and you’ll see your top rated songs in rhythmbox player.
marcos@marcos-laptop:~$ sudo perl Desktop/transferratings.pl Desktop/iTunesLibrary.xml /usr/share/gnome/help/rhythmbox/C/rhythmbox.xml
Parsing iTunes Library…
Parsing Rhythmbox Library…
Out of memory!
marcos@marcos-laptop:~$
took me like 45 minutes and didn’t work.
tried to do what Ankush said, but I quite don’t get it exactly
With me it does not work :-(
It seams that he has updated to python so i enterd this:
python transferRatings-0.8.1.py /home/guido/itunes.xml /home/guido/.local/share/rhythmbox/rhythmdb.xmlg
but with the last g i get an error. without not. i even get the messag “done” but in rhythembox is nothing to see :-(
i am getting notification of “Rhythmbox database defaults to ~/.gnome2/rhythmbox/rhythmdb.xml” and nothing happens. I have typed the follwing
perl transferratings.pl /media/MEDIA 1/SOUNDS/I Tunes/Library.xml /home/myname/.local/share/rhythmbox/rhythmboxdb.xml
help?
Full Guide…
Import iTunes Library into Rhythmbox (Ratings and Playcounts included) | Nathan Jamins Weblog…