I recently installed Ubuntu on a new machine and wanted to bring along my music collection to use with Rhythmbox. This was trivial, I just copied the Music folder from my old machine to my new via an external USB hard drive and let Rhythmbox on the new machine search through the folder at first run. Then I wanted to listen to the radio and tried the radio tab in the sidepanel in Rhythmbox, but all the stations I had added to my old installation was no where to be found. So I did a little digging around the internet to come up with a solution.
It turns out that the Rhythmbox radio stations are stored in the same database file that the whole music library database is stored in. Unfortunately, I could not just copy the database file, since the links in the file are hard links and the user names (and home folder names) are different on the two machines. Changing all the song entries would have been tedious, but I found another way.
What I did was open the file ~/.local/share/rhythmbox/rhythmdb.xml in gedit. (Open a terminal and write gedit ~/.local/share/rhythmbox/rhythmdb.xml and press return.) Then I searched for “iradio” by clicking on the magnifying glass and scrolled down until I found the radio stations I had added. I then selected everything from <entry type=”iradio”… until /entry> after the last of my added radio streams and copied it (press ctrl-c). Next, I opened a new file in gedit and pasted my text (ctrl-v) and saved the new file to a USB thumbdrive. On the other machine, I inserted the thumb drive, opened my saved file in gedit (right-click the file name in Nautilus and select “Open with” and “Text editor”) and copied everything in the file (press cttrl-a and ctrl-c). Then I opened the ~/.local/share/rhythmbox/rhythmdb.xml file in gedit (open a terminal and type gedit ~/.local/share/rhythmbox/rhythmdb.xml and press return), searched for “iradio”, scrolled down to the last radio station, set the marker after the last “/entry>”, hit return, pasted my radio station entries (ctrl-v), checked that there were no extra empty lines before or after my radio entries and then I saved the file. When I opened up Rhythmbox, my radio stations were there and streaming radio was working fine.