Podcast automation without iTunes
May 16th, 2008 3 Comments
A lot of people still think that you need an iPod to listen to podcasts. Podcasting was lucky to piggyback on the phenomenal success of the iPod and the result was a lot of people listening to podcasts who wouldn't have been if the iPod had never been invented, or if podcasts hadn't been called podcasts. However, the name podcast has also had the downside that lots of people assume podcasts require an iPod. So there are lots of people out there with MP3 players, PDAs and media-playing mobile phones don't realise they could be part of the podcast-listening community.
I've been listening to podcasts since mid-2005 but have never owned an iPod. I started listening by just downloading MP3 files and playing them on my PC on Windows Media Player, then got a PDA and started using that, transferring files over from PC to PDA via ActiveSync (a painfully slow process). I then discovered podcast clients that handled the downloading for you, and settled on Juice as the best of them. Then, after the PDA packed up, I was using a little stick-like MP3 player, again manually transferring files across from the Juice download directory onto the MP3 player.
Finally, last year, I got a company Blackberry Curve, which includes pretty decent music playing software, and I started using that. I used the Sync feature in Windows Media Player to copy files onto the Blackberry. But it was still a little bit of a manual process to have to open Media Player and click Sync > Blackberry. What I wanted was the seamless experience of the iPod and iTunes, where syncing happens without any manually effort other than plugging in your iPod.

The following instructions tell you how to achieve this. It's a bit geeky I admit, but once you've set it up you don't need to do anything but plug in your MP3 player, phone or PDA and it gets loaded up with the latest podcasts you want to listen to. Additionally, it deletes old podcasts for you, so you don't have to do that manually to free up space for new stuff.
The method requires the following (more detail in the instructions below):
- A Windows PC
- An MP3 player of some description that shows up as an external storage device in Windows Explorer (in my case my Blackberry Curve
- Perl installed on the PC
- A couple of Perl scripts written by me (see below)
- A podcast receiver such as Juice
- Microsoft SyncToy
Of the above, you only need to pay for the hardware - all the other items are free downloads. So here are the setup steps.
How to set up automatic podcast delivery to your MP3 player
- Download and install Perl.

I use ActivePerl from ActiveState. There might be other versions of Perl for Windows, but ActivePerl is easy to install and does the job, so I'd recommend using that. Download the Windows MSI installer from ActiveState and then just run it like any Windows installer. It's dead easy, but if you need instructions you can find some in this article on About.com.Note: You want the Standard distribution, which is free. You'll get asked for registration details but you can leave the fields blank and just click Next if you want. - After installation is complete, open a command console window and type perl -v.If Perl is correctly installed you should see the Perl version details.


- Download and install Juice, or any similar podcast receiver.

- Subscribe to some podcasts in your podcast receiver.
- Set up the podcast receiver so that it starts up when Windows launches (e.g. put a shortcut to the application in the Startup subdirectory of the Windows Start menu) and set the download folder in the Preferences, making sure there are no spaces in your directory names (i.e. D:\MyStuff\MyPodcasts good, D:\My Stuff\My Podcasts bad).


- Set the scheduler so that as well as checking for new podcasts when the application start (see the Preferences) it also checks at regular periods thereafter. For example, I have Juice set to check for new podcasts every four hours:


So you've now got things set up so that you get new podcasts onto your PC automatically. Pretty straightforward stuff so far. The problem with this setup is that your hard disk will gradually fill up with an enormous amount of MP3s. The next thing to do is to set up a Perl script that will delete old files from your download location for you. - Create a directory to hold the Perl scripts you're going to need. For example, mine live in:D:\Alistair\ProgrammingStuff\PerlScripts
Note: As previously noted, the directory names shouldn't have any spaces in them. - Use the following link to download a zip file containing two Perl scripts:http://www.itauthor.com/wp-content/uploads/2008/05/podcastperlscripts.zip
- Unzip the file and save deleter.pl and run-synctoy.pl to the directory you created in step 7.The script we're interested in right now is deleter.pl. It's a simple script that just deletes files in or below a specified directory that are older than a specified number of days old. Here's the code in case you're interested (don't worry, you don't need to understand this to use the script):
1: #!perl -w
2:3: use strict;4: use File::Find;5:6: # This script deletes all files older than a specified age
7: # in, ***or below***, a specified directory
8: # (or the current directory if none specified)
9:10: # To test the script (i.e. list files that would have been
11: # deleted, without actually deleting them),
12: # comment out the line containing "unlink $_".
13:14: usage() if (! @ARGV || $ARGV[0] =~ /\D/);
15:16: my $age = $ARGV[0];17: my $dir = $ARGV[1] || '.';
18: my $message = "\nThe following files have been deleted:\n";
19: my $files = "";
20:21: find(sub { $files .= "$_\n" if (-M $_ > $age && $_ ne "."); }, $dir);
22: find(sub { unlink $_ if (-M $_ > $age && $_ ne "."); }, $dir);
23:24: $message="\nNo files were deleted.\n\n" unless $files;
25: print $message.$files;26:27:28: sub usage {29: print <<'EOF';
30:31: USAGE:32: ========33: <scriptname> n [directory]34:35: Where:36: - scriptname is the name of this Perl script.
37: - n is the number of days previous to today.38: - directory is an optional parameter that specifies39: the directory where files exist.40: Note: the default is the current directory.
41:42: For example:43: - "perl deleter.pl 5" - deletes files older than 5 days.
44: - "perl deleter.pl 120 c:\temp" - deletes files in or below the
45: c:\temp directory that are older than 120 days.46: EOF47: exit;48: }
Now the script is in place, you can set up a Windows scheduled task to run this script. - From the Windows Start menu select All Programs > Accessories > System Tools > Task Scheduler.
- Choose Action > Create Task.Note: These instructions are for Vista but the process should be very similar on XP.
- In the General tab, give the task a name – for example, podcast-deleter.

- Make sure the Run with highest privileges check box is selected.
- In the Triggers tab, click New.
- In the New Trigger dialog box, set up the schedule for the task. For example, I have my task scheduled to run daily at lunchtime (13.19 to be precise).

- Make sure the Enabled check box is selected and click OK.
- In the Actions tab, click New.
- In the New Action dialog box, leave the Action as Start a program.
- Click Browse and find the perl executable file. If you installed ActivePerl, the path is probably C:\Perl\bin\perl.exe.
- In the Add arguments field, enter the following on one line:
– the full path to the deleter.pl script
– the number of days old a file must be older than for it to be deleted (I've got mine set to 5)
– in double quotes: the full path to the directory into which your podcasts are downloaded
The value I have in this field is:
D:\Alistair\ProgrammingStuff\PerlScripts\deleter.pl 5 "D:\Alistair\Downloads\podcasts"
Note: you can leave the Start in field blank. - Click OK and, back in the task Properties dialog box, click OK again.
You've now got a scheduled task that will run automatically every day and delete your old podcast files. I listen to a lot of weekly podcasts, mainly from the BBC, and I've almost always listened to them within the 5 days they get to stay on my PC.
Now let's turn our attention to getting the podcasts onto your MP3 player. - Download and install SyncToy from Microsoft.
Note: Make sure you get version 2.0 or higher. If the link above doesn't work by the time you're reading this, go to the Microsoft Download Center and search for "SyncToy".SnycToy is a great, free application whose silly name belies the fact that it is a seriously useful tool. In short what it lets you do is choose two folders that you want to synchronise. Typically you'd use it to automatically backup documents, images or music onto a network drive, an external hard drive or another computer on your network. But here we're going to use it to copy over your podcasts from your PC to your MP3 player, phone, PDA etc. - Make sure your MP3 player is connected to your PC.
- Start SyncToy and click Create New Folder Pair.
- Using the Browse buttons, enter the paths to the podcasts directory on your PC ("Left Folder") and the destination directory on your MP3 player ("Right Folder").

- Click Next.
- Select Echo.
Echo provides a one-way sync from left to right. This means that new podcasts on the PC will get copied to your MP3 player, and when the script deletes podcasts they'll be deleted from the MP3 player. - Click Next.
- Give the sync job a name, making sure the name doesn't contain any spaces.

- Click Finish.
- You can now click Run to run the synchronisation for the first time.
Note: the first time you run a synchronisation it may take quite a long time to complete. Be patient. For subsequent syncs it does incremental backups and is much faster. Now we need to automate SyncToy to run at regular intervals. Fortunately, SyncToy comes with a separate executable that's designed to be run from the command line. We're going to use the other Perl script you downloaded to run this executable silently, in the background, without the user interface being displayed. - Go to the location in which you saved the Perl scripts you downloaded earlier and open run-synctoy.pl in a plain text editor such as Notepad or UltraEdit.
- Carefully edit the values for the three variables so that they reflect the correct details for your setup:
$destination
The full path to the directory on the MP3 player where you want podcasts to be synced to.
Note: Make sure you use two backslashes for every backslash in the path (so G:\Music becomes G:\\Music).
$synctoy
The full path to the SyncToyCmd.exe file.
Note: If the path contains any directories with spaces in their names you're going to have to rename these. For instance, I had to rename SyncToy 2.0 Beta as SyncToy-2.0-Beta. Also, make sure you specify the command-line version of the application, SyncToyCmd.exe, and not the user interface version: SyncToy.exe.
$flag
The name you gave to the folder pair in SyncToy.
Note: the quoted value must start with a space followed by -R followed directly, with no space, by the name of the folder pair.
Here's what my version of the file looks like:
1: #!perl -w
2:3: use strict;4:5: # Edit the following to the destination drive & path for your MP3 player:
6: my $destination = "G:\\Music";
7:8: # Edit the following to the path to SyncToyCmd.exe on your computer:
9: # Note: The path must not contain any spaces.
10: my $synctoy = "D:\\programs\\SyncToy-2.0-Beta\\SyncToyCmd.exe";
11:12: # Edit the following to "<space>-R<name of folder pair set up in SyncToy>:
13: my $flag = " -Rpodcasts-to-blackberry";
14:15:16: unless (-e $destination) {17: die ("The desintation location:\n" . $destination . "\ndoes not exist -");
18: }19:20: unless (-e $synctoy) {21: die ("SyncToy not found at the specified path:\n" . $synctoy . " -");
22: }23:24:25: `$synctoy, $flag`; - Save your changes.
OK, we're near the end now. Congratulations if you've got this far.
Pretty much all we have to do now is set up another Windows scheduled task to run this Perl script on a regular basis. The reason for using a Perl script here, rather than just running the executable directly is that it allows us to check whether the remote destination is available (e.g. your phone or MP3 player is connected to the PC) before attempting to run SyncToy. - Back in Task Scheduler (All Programs > Accessories > System Tools > Task Scheduler) choose Action > Create Task.
- In the General tab, give the task a name – for example, Sync-podcasts-to-Blackberry.
- In the Triggers tab, click New.
- In the New Trigger dialog box, set up the schedule for the task.
- You probably want to set up a few of these triggers because you may not always have your MP3 connected when the task kicks off, especially if it's your phone. For example I've got four triggers set up, at 11am, 1pm, 3pm and 5pm:

- In the Actions tab, click New.
- In the New Action dialog box, leave the Action as Start a program.
- Click Browse and find the run-synctoy.pl script.
- Leave the Add arguments field empty and in the Start in field add the path to the directory in which Perl lives. If you installed ActivePerl, the path is probably C:\Perl\bin.
- Click OK and, back in the task Properties dialog box, click OK again.
You've now got a scheduled task that will run automatically several times a day, causing SyncToy to copy new podcasts to your MP3 player and delete the old ones.
And that's it!
The beauty of this setup is that the end result is you always have a recent selection of podcasts to listen to on your MP3 player, you don't have to manually delete old podcasts, all you do need to do is plug the device into your PC. Job done!
Potentially similar posts
- My first (useful) Ruby program – June 2011
- Adding your choice of text editor to Flare’s Open With menu – December 2010
- Perl basics for beginners (on Windows) – August 2010
- Gotchas with running a Perl script as a cron job – August 2010
- EasyListener resurrected – June 2010
June 4th, 2008 at 9:26 pm (#)
This is great and just what I've been looking for since I got my Blackberry curve. I don't understand why a product doesn't exist to fill this niche yet, but this is the best thing I've found so far. A better podcast player (with bookmarking) for the Blackberry would be good also. I've tried eplayer but it is buggy and limited.
December 15th, 2008 at 8:26 pm (#)
Just found this. I am merging my MOTO Razer, ipod nano, and iPAQ to a HTC 6800. This is just what I am looking for (I hope)
September 24th, 2009 at 10:47 pm (#)
You can also try Feed Flipper. It's a free online service that converts an iTunes podcast into a RSS feed which can be subscribed to from any RSS news reader.
Feed Flipper: http://picklemonkey.net/flipper/convert.php