I am sick and tired of trying to find a really good podcast client. iTunes has the best "reach" but itunes sucks in every other respect (I love it when I shift click a bunch of things while iTunes is thinking real hard about something for 30 seconds, then I release shift, and iTunes thinks I have selected just the last thing  - "he's not holding down shift now!")

I've tried maybe a dozen other podcast clients and none were worth remembering their names so I could run them again. A couple of days ago I noticed winamp had podcast client functionality. After using it for three days and having winamp crash regularly while trying to manage my podcasts, I gave up and tossed it in the pile with the others.

So, I thought, how fracking hard can this be? A podcast client: it reads rss, looks at the url of enclosures, and downloads them. What do I know that is really good at letting me work with XML and is really simple...hmmm....

So I quickly threw together this powershell script (I actually prototyped the whole thing as a single command line pipeline). Nothing special, but way better than any of the other podcast clients, and I can make it work exactly how I like:

$rootPodcastFolder = 'E:\Downloads\Podcasts'
$feeds = @(
	'http://leoville.tv/podcasts/twit.xml',
	'http://feeds.feedburner.com/rubiverse',
	'http://feeds.feedburner.com/netRocksWmadirect',
	'http://feeds.feedburner.com/altnetpodcast',
	'http://channel9.msdn.com/rss.aspx?threadID=312315&format=wma',
	'http://feeds.feedburner.com/Hanselminutes',
	'http://www.npr.org/rss/podcast.php?id=13',
	'http://www.npr.org/rss/podcast.php?id=5',
	'http://blog.stackoverflow.com/?feed=podcast',
	'http://feeds.thisamericanlife.org/talpodcast',
	'http://podcast.thoughtworks.com/itmatters/it_matters.xml'
)
$agent = new-object net.WebClient

foreach ($feed in $feeds) {
	$document = [xml] $agent.DownloadString($feed)
	$title = $document.rss.channel.title.Replace(':', '-')
	$feedFolder = [io.Path]::Combine($rootPodcastFolder, $title)
	if (![io.Directory]::Exists($feedFolder)) {
		[io.Directory]::CreateDirectory($feedFolder)
	}
	Write-Output "Checking $title ($feedFolder)..." 
	
	foreach ($item in $document.rss.channel.item) {
		$fileName = [io.Path]::GetFileName($item.enclosure.url)
		$fileName = [io.Path]::Combine($feedFolder, $fileName)
		if (![io.File]::Exists($fileName)) {
			"`tDownloading {0}..." -f $item.enclosure.url
			$agent.DownloadFile($item.enclosure.url, $fileName)
		}
	}
}

Now, if only powershell could help me copy these files to my windows mobile phone in less than the decade I've been waiting so far...


 
Categories: