Wouldn’t it be great if I was notified when a new podcast download had completed and could simply plug in my MP3 player and the PC copied over the files automatically? There didn’t seem to be anything out there that automated things to this degree so I decided to roll my own. Here’s what should happen:
- Podcast app downloads new episodes from the RSS feeds I’m subscribed to
- Podcast app should update my ‘completed downloads’ RSS feed with the latest podcast (this feed is read on my desktop at work). This is achieved through a simple script that’s executed when the download completes.
- If the podcast app doesn’t support scripts and you’d like to reorganise the downloaded files or run a script, then use File Mover as an intermediate step.
- Detect when a USB storage device is inserted
- Based on the USB device’s label, run a specific script, which in this case will move .mp3’s to my MP3 player, and move video episodes of Diggnation & Hak5 to a USB memory stick so that I can get them on my laptop with the minimum of fuss.
The New Application
Detecting a USB storage device and running a specific script based on it’s label isn’t something I found an application for. That’s when wrote my own app to do exactly that.
Like with most of my utilities, the program is quite simple, with the power coming from being able to fire off a script which you can do almost anything with. In this case I’ll write a simple script to copy over any .mp3 files onto my appropriately labelled MP3 player, and anything else goes onto my 2GB USB stick.
The new app is called USB Detect & Launch and is available here for download. It’s effectively a beta, so give it a try and let me know whether it works for you!
Putting It All Together
1) Install Juice (or whatever app you’re going to use to subscribe to podcasts with)
2) Add the RSS feeds for the podcasts you want into Juice. E.g. Diggnation has them listed on the right hand side of the page, just pick the type of file you want (MP3, WMV, Xvid, etc).
3) Set up the destination folder for the downloaded podcasts
4) Set up the download schedule so that new podcasts are automatically downloaded
If you want to use RSS to inform you of newly downloaded podcasts follow the next steps, otherwise skip to step 8.
5) Write a quick script to add a few lines into our ‘completed downloads’ RSS feed so you’ll know when a new podcast is available even when you’re not near your server.
6) Add the script to Juice. Note; if you’re using another app that doesn’t support scripts in this way, then you can easily use File Mover as an intermediate step.
7) Setup your LAMP/WAMP installation to use a PHP script that will generate the RSS feed of completed downloads. The PHP script parses the logfile written by the script in step 5 and makes it into a simple feed.
Back to the automation…
8 ) Install and configure USB Detect & Launch. For each USB device you want to sync to, build up a simple script using the volume name, and the script you want to execute when the device is inserted.
exec:wscript “c:\backup.bat” “%1” “%2”
exec:wscript “c:\batch\copy-to-mp3-player.bat” “%1” “%2”
%1 is replaced by the drive letter of the attached device (e.g. e:\)
%2 is replaced by the volume label of the attached device (e.g. PENDRIVE)
9) Write the script that’s called from USB Detect & Launch. The scripts can be as complex as you need them. A simple example would be to copy all the files from one of your podcast folders to your MP3 player using a batch script like this:
rem USB Detect & Launch will put the drive
rem letter of the USB storage device into %1
copy /Y “c:\podcasts\hak5\*.*” %1
Or maybe using xcopy to move all the sub-folders (/S) over would be better. Xcopy’s other options (/M) also allow you to copy over files with the Archive attribute and can reset this attribute after the copy.. essentially only copying the files over once, whilst keeping a copy on your hard drive:
xcopy f:\podcasts %1podcasts /M /S /Y
Test The Setup…
10) That’s it. Start up Juice, and start USB Detect & Launch.
Test the process by subscribing to a new feed of podcasts. Let Juice download the latest episode automatically. When the download has completed you should find the file added to your RSS feed:
At this point you can insert your USB device and it should be detected & your podcasts will be copied over using the batch script you’ve written.