Download Podcasts and Sync Music Automatically With podget

Author Note: This was originally posted on in 2008. I am replicating it here for posterity.

Many so-called podcatchers have shown up to help users download podcasts on request. Most of them are great applications, but what do you do when you want all of your podcasts downloaded automatically and synced to your MP3 player? I used to use Monopod to download podcasts and then move them to my MP3 player by hand — until I found podget. Using podget, cron, and some shell scripts, I was able to automate the whole process, saving myself 10 minutes and unneeded hassle every day.

To get started, download podget, unpack it, and change into the newly created podget directory. With sudo, or as root, run make install, then run podget so that it can configure itself. By default the first run will download several podcasts from a predefined list. To disable this feature, pass podget the -C option; this puts podget in cleanup mode.

On the first run podget creates two configuration files, podgetrc and serverlist, both in ~/.podget. In podgetrc you can set podget’s configuration parameters; in serverlist you specify the podcast RSS feeds to download. For complete configuration information refer to the podget documentation.

Adding podcasts to a generic music device

There are thousands of portable music devices on the market these days, and each of them behaves differently. Fortunately, most popular devices behave as external hard drives under Linux. Taking advantage of this allows for easy syncing. Consider the following shell script:

mount /dev/sda1 /media/usbdisk 
cp -Ru ~/POD /media/usbdisk 
umount /media/usbdisk

The script mounts the device (/dev/sda1) to /media/usbdisk, then copies new and changed files over recursively. Finally, it unmounts the device. The user running this script must have mount privileges.

Adding podcasts to an iPod

While that script should work for any portable music device, you can sync your iPod automatically using GNUpod. (iPod support on Linux is experimental, and if not done properly can have disastrous results, so be careful.)

#!/bin/sh -m /media/ipod
find ~/POD -type f -name '*.mp3' -exec -m /media/ipod {} \; -m /mnt/ipod
umount /mnt/ipod

This script mounts the iPod, copies all of the available MP3 files to it, updates the database, and unmounts the mount point. Again, this script must be run by a user with permission to mount.

Automating the process

Adding the following line to the crontab automates podget and the syncing script:

15 04 * * * /usr/local/bin/podget -s && /path/to/sync/script

This line tells cron to run podget and the sync script every morning at 4:15. Obviously the audio device needs to be attached to the computer for the sync script to work.

If you subscribe to several active podcasts, you know that keeping up-to-date with them is a tedious task. This simple process, along with a morning stroll, has made that task much easier for me.