Autofill the iPod Shuffle from the Linux command line
I love my iPod Shuffle. I also love Linux. As I’m on a quest to being 100% Windows free, that means finding ways to get all the stuff that talks to the computer, to talk to it under Linux. Thankfully it’s not a difficult goal to reach, and it usually means that everything ends up being simpler and more efficient in the long run.
Getting an ipod to talk to Linux is easy, thanks to gnupod. That’s a set of perl scripts which lets you add and delete things on your ipod as well as keeping your all important iTunes DB up to date. There are great GUI-based solutions too, including GTKPod and even the mighty Amarok (more about which in another blogpost later). I’m a command-line guy at heart though, so gnupod suits me fine.
Unfortunately, gnupod isn’t perfect. While it does what it does well, it’s far from being the most user friendly set of scripts out there. The command line parameters are pretty arcane and it doesn’t handle the Shuffle’s all-important Auto-Fill magic.
It’s easy enough to fix that with a few wrapper scripts though. After much trawling around the net I found this page which contained all of the meat I needed. I’ve re-written it from being a mixture to bash and perl into an all-perl solution. First, install gnupod then download my autofill script here.
Make it executable (
chmod +x autofill). Change the variables at the top of the script – $mount, $source and $size – to reflect your system. $mount point is wherever your Shuffle is mounted when it’s plugged in. $source is the directory containing all of your mp3s. The script will search down through the folders underneath this one.
When it’s run, autofill will wipe your Shuffle clean, then fill it randomly with tunes from your source directory. Later, I plan to update the script to provide the option whether to wipe the Shuffle, or to append to what’s already there. For now though, it’ll do. Not bad for 1.1k
In previous blogposts I’ve looked at whether it’s possible to use the iPod without iTunes and the answer back then was a resounding YES. Now I’m one step further – I can use the iPod without iTunes, or Windows! Perfection.