Podcast Download and Sync Script by Michael Spiceland license: GPL v2 (see LICENSE) This archive is a collection of Perl scripts that one can use to easily auto download the latest podcasts and sync them with a mounted mp3 player. This setup is ideal for those of us with Palm Pilots, Pocket PC's, and other portable MP3 players that mount as a normal drive that cannot use iTunes or the other fancy sync programs. Here is the short version: 1. Create a .txt file with all of the rss feeds for your podcasts. 2. Setup cron (or another any scheduler) to run podcast-download.pl periodically to download all of the latest podcasts (e.g. each night). 3. When you want to dump the latest to your portable device, run podcast-sync.pl Now for the long version: ------------------------------------------------------ 1. adding your podcast rss feeds ------------------------------------------------------ First, you "subscribe" to the podcasts that you want to download by putting the RSS feed URL into the podcasts.txt file. For instance, here is a sample: TWIT==http://leo.am/podcasts/twit Security Now==http://leo.am/podcasts/sn Market Place==http://marketplace.publicradio.org/RSS/marketplacetakeout.xml Notice, it is 'name==url'. ------------------------------------------------------ 2. run podcast-download.pl periodically ------------------------------------------------------ Here is an example of how to run it each night at 1AM in cron (crontab -e): 0 1 * * * /entire/path/podcast-download.pl If you do not set cron to have the directory that contains podcast-download.pl to be the currenet working directory, you will have to edit the podcast-download.pl file and set $podcast_directory to the directory you want to use. Make sure that directory has the podcasts.txt file and the podcast-sync.pl file. ------------------------------------------------------ 3. sync the latest podcasts with your device ------------------------------------------------------ Run podcast-sync.pl like so: ./podcast-sync.pl The above assumes that you've edited the first few lines with your desired mount-point and path on your memory card/device. For instance, I mount to /mnt/removeable2. On my card, I put my podcasts in audio/podcasts/. I use the following at the top of the file: $device_mountpoint = "/mnt/removeable2"; $device_path = "audio/podcasts"; If you don't want to edit the file, or if your mountpoint changes frequently, you can overwrite whatever is in the file by running: ./podcast-sync.pl /media/flash Now this is where the magic happens. The script keeps a list of the podcasts previously transferred and only transfers the new ones. Also, it checks the available room left on the device and keeps transferring new files until it is full. Once it is full, it stops. It gives each "channel" or rss feed equal priority. It will go to each one in "round robin" fashion getting one podcast from each channel until it is done. This lets you get a mix of all of the latest podcasts instead of filling the device with only one podcast. ------------------------------------------------------ Tricks ------------------------------------------------------ If you don't want to have to download all of the mp3's for a feed, if you "touch" a file with the same name, it will take up 0 bytes but will keep it from downloading the mp3. An easy way to do this is to open up podcast-download.pl and comment out the 'wget' line. Now uncomment the 'touch' line below it. Run it once and it will create a blank file in place of each mp3. Now revert the script back to the original and it will only download new episodes. ------------------------------------------------------ Changes ------------------------------------------------------ v0.2 - added $podcast_directory so that it runs cleaner from cron