[Home](/) I wanted to migrate my ~10 year old iTunes library to something on Linux. I searched for music players and Rhythmbox (https://wiki.gnome.org/Apps/Rhythmbox) seemed good. I liked that it looks very similar to the old iTunes. I found https://github.com/phauer/migrate-itunes-to-rhythmbox which was just what I needed to do this migration, but it's 7 years out of date and has a number of open issues. ## My starting state * Computer running Debian 12. * Drive containing my iTunes data: `/mnt/nas/media/audio/iTunes/` * This includes music files like: `/mnt/nas/media/audio/iTunes/iTunes Media/Music/The Beatles/Yellow Submarine.m4a` * and also the iTunes database in xml format: `/mnt/nas/media/audio/iTunes/config_backup/2023-08-03 backup/iTunes Music Library.xml`. Your config will probably be in the root iTunes directory. I made periodic copies. * Rhythmbox installed (it came pre-installed on Debian). * Directory where I want my music to live: `/home/omustardo/ssd/rhythmbox_music/` ## My steps 1. I am not entirely sure if this is required, but I deleted existing Rhythmbox content in `/home/omustardo/.local/share/rhythmbox/`. It may be possible to merge an iTunes library into an existing Rhythmbox setup, but I didn't do that so this document doesn't cover it. I left `rhythmdb.xml` but deleted the internet radio entries in it. I think they cause a mismatch later on since the iTunes data didn't include them. The error was: ``` $ ./migrate-all.sh Reading iTunes library in ./iTunes Music Library.xml Creating Rhythmbox playlist in /home/omustardo/.local/share/rhythmbox/playlists.xml Finished Reading iTunes library in ./iTunes Music Library.xml Adding play counts and ratings to Rhythmbox DB in /home/omustardo/.local/share/rhythmbox/rhythmdb.xml The rhythmbox location http://ubuntu.hbr1.com:19800/trance.ogg doesn't start with a known prefix. It's likely that we can't match it later to a itunes path. No songs have been changed. Probably because the iTunes and Rhythmbox song paths could not be matched together. Please check your source_library_root and target_library_root. ``` 2. I had trouble getting pip3 install to work, so I just downloaded all of the code, stuck it in a single directory, and tried to run it repeatedly. I had to fix a lot of errors but eventually it worked. My final set of files is: ``` -rw-r--r-- 1 omustardo omustardo 764 Nov 25 2016 common.py -rw-r--r-- 1 omustardo omustardo 720 Dec 27 16:34 itunes_library_reader.py -rw-r--r-- 1 omustardo omustardo 5674 Dec 27 16:44 Library.py -rwxr-xr-x 1 omustardo omustardo 644 Dec 27 20:47 migrate-all.sh -rwxrwxr-x 1 omustardo omustardo 5093 Dec 27 16:17 migrate-itunes-to-rhythmbox.py -rw-r--r-- 1 omustardo omustardo 198 Dec 27 15:25 Playlist.py -rw-r--r-- 1 omustardo omustardo 5484 Dec 27 16:20 rhythmbox_count_rating_integrator.py -rw-r--r-- 1 omustardo omustardo 2510 Dec 27 16:20 rhythmbox_playlists_writer.py -rw-r--r-- 1 omustardo omustardo 588 Nov 25 2016 settings.py -rw-r--r-- 1 omustardo omustardo 1652 Dec 27 15:25 Song.py -rw-r--r-- 1 omustardo omustardo 1283 Nov 25 2016 transform.py -rw-r--r-- 1 omustardo omustardo 294 Dec 27 15:25 XMLLibraryParser.py ``` Notable changes were updating all of the imports (python uses `from import `) and updating a plist usage (https://github.com/phauer/migrate-itunes-to-rhythmbox/issues/27). 3. Moved the iTunes music files to where I wanted Rhythmbox to look for them. For me: `cp -r "/mnt/nas/media/audio/iTunes/iTunes Media/Music/"* /home/omustardo/ssd/rhythmbox_music/`. Note the quotes and asterisk are due to spaces in the name. 2. Modify `migrate_all.sh` to set your paths. Note that you cannot use spaces in the paths. Replace them with %20. Mine script contains: ``` python3 migrate-itunes-to-rhythmbox.py playlists \ --itunes_library_xml="./iTunes Music Library.xml" \ --rhythmbox_playlists_xml="~/.local/share/rhythmbox/playlists.xml" \ --source_library_root="C:/Users/Omar/Music/iTunes/iTunes%20Media/Music/" \ --target_library_root="/home/omustardo/ssd/rhythmbox_music/" python3 migrate-itunes-to-rhythmbox.py counts-ratings \ --itunes_library_xml="./iTunes Music Library.xml" \ --rhythmdb="~/.local/share/rhythmbox/rhythmdb.xml" \ --source_library_root="C:/Users/Omar/Music/iTunes/iTunes%20Media/Music/" \ --target_library_root="/home/omustardo/ssd/rhythmbox_music/" ``` 3. Run `migrate_all.sh` Weirdly this seemed to only partially work on the first run. It migrated ~4000 of my ~15k songs. I don't know what I did to fix it, but I think it was just re-running it a few times that did it. ## Optional Unlike most music players, Rhythmbox doesn't use space to pause and play. Instead it just plays and also restarts the song from the beginning. Very weird decision on their part. The way to work around this is to create a custom keyboard shortcut which uses `rhythmbox-client` to toggle the play/pause state. I set mine to ctrl-shift-space, which triggers `rhythmbox-client --play-pause`.