Hack 43. Sync Your iRiver with Linux
Use Linux to copy your songs and create the iRiver database.
Of the wide variety of "lifestyle" items that are competing for our disposable income, the personal music player is one of the most popular. Although many of us can remember the excitement of getting a personal cassette player when we were younger, the latest incarnation of music on the move is fully digital, and it can store your entire album collection.
A number of these personal music players are on the market, but one of the most intriguing is the iRiver series. Not only do these little boxes pack in upward of 40 GB of storage, but they also support a variety of different codecs beyond plain MP3. Some of you might be aware that encoding MP3 is actually a legally foggy area, as the codec was created and licensed by Fraunhoffer, and many free encoders are not properly licensed. A free MP3 alternative called Ogg Vorbis promises both higher quality and smaller file size. This format is gaining in popularity, and the iRiver, unlike the iPod, supports it out of the box.
To get songs on your iRiver, you need to rip your CDs to get the tracks onto the hard disk of your Linux machine, encode them as MP3 or Ogg Vorbis, and then upload them to the iRiver via USB. Optionally, you can then build the iRiver internal database for your MP3s (you cannot use the database for Ogg files). The iRiver IHP series of players uses a special internal database that stores all the details of your song titles, albums, genres, and other information. One issue to bear in mind is that the iRiver lacks support of Ogg Vorbis tags. This means Ogg metadata will not be included in the database. If you want to use ID tags (these tags store information about the artist, album, track number, and so on), you need to rip your songs as MP3s.
This hack does not cover how to rip songs, but a number of great ripping tools are available, such as Grip, RipperX, KAudioCreator, and Jack. Most of these tools are simple and intuitive to use.
2.32.1. Transfer the Songs to the iRiver
You can transfer songs to the iRiver by plugging it into one of the USB ports on your computer. To transfer files, you need to ensure that you have USB support compiled into your kernel, and then you need to mount the device.
These options are available in the kernel configuration tool in the USB Support section. You should ensure that you have UHCU, UHCI Alternate Driver, or OHCI selected, depending on the type of USB support on your motherboard. You can find out which USB support you have from your motherboard's manual. With the USB support compiled, you can mount the disk with the following command:
$ mount -t vfat /dev/sda1 /mnt/iriver
You will probably need to change the mount directory /mnt/iriver to something that is relevant to your system. Once it is mounted, if you look in /mnt/iriver, you will see either an empty directory (if you have not uploaded any songs) or a list of artist directories (if songs are already on the iRiver). Now you can copy over files by using a file manager such as Nautilus or Konqueror, or by using the following command if your Metallica songs are in /home/joeblogs/Metallica:
$ cp -r /home/joeblogs/Metallica* /mnt/iriver
2.32.2. Rebuild the Database
The iRiver database is essential in terms of making the iRiver as usable as possible. This database contains a detailed list of artists, genres, albums, song lengths, track numbers, and more; many of the features in the iRiver are available only if you have created the database. You still can use the iRiver without the database, but you can choose your songs and albums only via the clunky file manager on the iRiver as opposed to its special menus. Unfortunately, the installation CD does not come with a tool to build the database for Linux, but a simple utility available on the Internet, called iRipDB, can do the job. You can download iRipDB from http://www.fataltourist.com/iripdb/.
Once you have downloaded the latest version of iRipDB, unzip it onto your hard disk with this command:
$ tar xcvf iRipDB-x-x-x.tar.gz
Replace x-x-x with the actual version number of the iRipDB program. You need to ensure that you have the following libraries on your system before you compile the code:
To compile the code, run the compilation script included with the code. Move into the directory where the code is stored and run this:
When the program is compiled, you will have an executable in the source directory called iripdb. Now you can run this to rebuild the database:
$ ./iripdb /mnt/iriver
The preceding command runs the iripdb command on the directory where you mounted your iRiver. You can also use thee switch to include files that have not had tags added to them:
$ ./iripdbe /mnt
To finish, you should unmount the device to ensure that all data has been copied over completely:
$ umount /mnt
Now full support for your iRiver is available on your system. Although you will mostly listen to music on your iRiver, try copying some text files onto the device. On the IHP series, you will find that you can read them on the screen. This can be handy if you need to carry around some notes or other text with you.