A couple of weeks back was my birthday and although i don’t really celebrate, my daughter wanted to get me a gift. Because we’ve gotten a new second hand car with an old tape deck that doesn’t support aux or something, i saw a so-called FM Transmitter. This is a device you place in you cigarette lighter in the car and you can connect a phone (over Bluetooth or AUX cable) or a simple USB stick. The AUX connection is crap! A lot of noise, but the BT and USB connection are oké. Main thing that i found as a disadvantage is that when you play music over the USB stick the music isn’t random. If you don’t like an album, you have to skip through al the songs of the album and hope you get a nice record after going through.

To solve this (and to learn the Python scripting language) i’ve created the next script:

It scans the source folder and for every file that ends with ‘.mp3’ it generates a random number between 100 and 999, and creates a folder of it. Then it generates a random number between 10000 and 99999 and makes a file out of it with the extension ‘.mp3’. In my situation there are 5000+ mp3 files, so there will be a descent amount of directories, with different filenames in them. When the files are done, i can copy them from the destination folder to my USB stick. Of course the destination folder can already be the USB stick.

If you are interested in the FM Transmitter, search for ‘BC06’. This is a very generic FM transmitter. I think you can by them in China and sell them under your own brand. I’ve seen them from MFEEL, Kebidumei, Kebidu etc etc etc.