Copying Librivox files to my mp3 player and getting them to play in the right order.

I don’t know how common this is, but I have an mp3 player, a Philips one in this case, a ‘GoGear RaGa’, which has to be one of the worst names ever. Anyway, when I download an audiobook from Librivox, and copy the mp3 files into a directory on the player (let’s assume I just use a folder off the root directory of the player. On my Debian system it mounts at /media/PHILIPS), they don’t play in the correct order, even when the files have names that list in the correct order. So I don’t know how the mp3 player orders them for playing, but it means that whenever a chapter ends I have to manually select the next file, rather than letting it play through. It is a pain.

Philips mp3 player, GoGear Raga. A few years old now...

Philips mp3 player, GoGear Raga. A few years old now…

One time I copied them over and the mp3 player played all the odd-numbered files then the even numbered ones, so I am wondering if it is something to do with the date/time/second the files were copied, and the way in which I copied the files (say a GUI that does them in some weird order or something, I have no idea). Hence, a belt-and-braces approach:

(1) I named them so they were properly consecutive. Note that 1_name.mp3 will often come after 10_name.mp3 since 0 comes before _ in ASCII value, so it was important (maybe?!) to use names like 01_name.mp3.

(2) Created a directory on the mp3 player and copied the files in the order I wanted them to play with separate copy commands. eg:

cp 01_filename.mp3 /media/mp3player/folder
cp 02_filename.mp3 /media/mp3player/folder

Now, if this is scripted, I suggest incorporating a pause between copies, to ensure that the times on the files are what is needed. For example, I would do an ls command to make sure the files come out in the order needed, then perhaps a script like below, where I run the script from the folder on the desktop computer that has the mp3 files in it:

mkdir $1
for f in *.mp3
  cp -v $f $1
  sleep 2s

so if the script is called copymp3 and made executable (chmod +x copymp3) and in the directory with the mp3 files, then I type:

./copymp3 /media/PHILIPS/foldername

and it will create /media/PHILIPS/foldername then copy a file, wait 20s, then copy the next. ($1 is just the first command line argument given to the script). Now, Linux will sometimes not actually do the write until some action occurs (hence the need to always unmount USB drives etc before removing them), but I have tried doing it this way and so far it seems to work; I can now start playing the first file in the folder and the mp3 player will jump to the correct next file.

I don’t see why a similar method would not work on Windows, just changing the script appropriately for the different environment.


Magical unrealism.


Tags: , , , , , , , ,

About Darren

I'm a scientist by training, based in Australia.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: