I've never before embraced the idea of listening to podcasts on a regular basis. With the recent purchase of an MP3 Player, it's garnered more of my interest. Unfortunately, I haven't stumbled on an automated approach to manage getting the downloaded podcasts synced to my player. I'm a creature of great laziness and would quickly lose interest in podcasts unless I find a way dump new episodes to my player with as little effort as possible.
I could probably find a client somewhere (iTunes? WinAmp?)... but what fun would that be?
I decided to play with the built in RSS Platform that's included as a part of Internet Explorer 7 (as such, IE 7 must be installed on your system). The RSS Platform includes a COM object which we can utilize from Powershell with ease. You could also use the FEED provider from PSCX if you chose.
Once you subscribe to the feed using IE7, view the Feed Properties and make sure you have the 'Automatically download attached files' option checked and set a reasonable limit for 'Keep the most recent items only'. I set my limit at 3 items. Keep in mind that if you totally automate this as I have, every podcast will be synchronized to your MP3 device which may have limited space.
Give the system some time to download your enclosures in the background.
Now, we run into the downside of using IE7's RSS Platform. It stores the enclosures in an obscure folder under the Temporary Internet Files. Let's take a peek at the object that will let us dive into the RSS Platform and find these mysterious enclosure folders.
$feeds = (New-Object -ComObject Microsoft.FeedsManager).RootFolder
$feedpodcast = $feeds.GetSubfolder('Podcasts')
I store all of my Podcasts in a folder off the root of the FEED listing called 'Podcasts'. The second line is getting the object that represents that level of feed listings.
We can get a list of all feeds in this folder using this:
66> $feedpodcast.feeds
Type Name ItemCount UnreadItemCount
---- ---- --------- ---------------
feed Adventures of Superman Podcast 47 0
feed Batman Adventures 25 0
feed British Science Fiction Podcast 3 0
feed Hanselminutes 3 0
feed Mind Of Root 3 0
feed PowerScripting Podcast 3 0
feed PowerShell Basics 3 0
feed Science Fiction Theater Podcast 58 0
feed Scifi Friday 3 0
feed X Minus One Podcast 46 0
feed .NET Rocks! 3 0
67>
Now, let's find the enclosure path:
84> $($feedpodcast.feeds)[5] | fl Name,Url,LocalEnclosurePath,DownloadEnclosuresAut
omatically
Name : PowerScripting Podcast
Url : http://feeds.feedburner.com/Powerscripting
LocalEnclosurePath : C:\Users\gaurhoth\AppData\Local\Microsoft\Window
s\Temporary Internet Files\Enclosure\{1BA818DF-D3
C1-447D-A57F-8097CD250521}
DownloadEnclosuresAutomatically : True
85>
Now we know where to find the downloaded podcast files. Whew. Armed with this, we'll be able to write a script that will tie in all of these Enclosure Paths into a single parent folder so that Windows Media Player can monitor and sync to my player. I'll save that for the next part.
Gaurhoth