Random randomness

This summer I was looking to buy an MP3 player. I wanted something simple & cheap. My only requirements was that it would have a flash card slot and FM radio, and that it'd be small. The only place I was planning ot use it was at the gym. I ended up making an impulse purchase at costco and I got myself this one: https://www.rcaaudiovideo.com/Cultures/en-US/ModelDetail.html?PCI=Lyra+Flash+Players&ProductID=RD1080

It's not so bad, but there's one thing that's been bugging me.

As you would expect, it can play your songs in random order. Only, the random sequence is always the same - it always plays track 14, 43, 42, 26, etc, where track numbers are based on the order the files were added to the device. This rather defeats the purpose of getting more memory for it; I've put all my good songs on one card, but since the random sequence is always the same I still hear the same songs in the same order every workout session. Changing songs on the card regularly is not an option, that's too much work.

Solution: I wrote a little command line utility that takes a folder name, and changes the order of all mp3 and wma files in that folder. It:

  1. Creates a temp folder on the device;
  2. Moves each song file, prepending the file name with a random number;
  3. Sorts the list of files in the temp folder based on file name;
  4. Moves the files in this sorted list back, one by one, restoring the original file name
  5. Removes the temp folder.

It's really quite easy. Since I'm moving - not copying - it's pretty fast, and I don't waste disk space. Every now and again, I'll just run it against the flash card and - hey presto - the randomization has been randomized.

To do: see if I can do something with autorun.inf so all I need to do in the future is plug the player into the USB port.


 This posting is provided "AS IS" with no warranties, and confers no rights.