PowerShell for MP3

1 minute read

PowerShell for MP3

I recently replaced my Mk7 Golf (Apple CarPlay included) with a Volvo V40. There’s a lot to like about the Volvo, but the only Podcast app available is Stitcher, and its implementation is “woeful” - the choice adjective from a support request to the Stitcher team! Even Volvo seem almost embarrassed by it - see the note below “Tips for using Stitcher”: Volvo apology

Currently, my favourite podcast is Developer on Fire by Dave Rael. I’ve learned something from almost every one of the dozens of episodes that I’ve listened too so far. They almost make an hour’s drive to a client site worthwhile!

I wanted a quick way to download all the episodes onto a USB stick - thankfully, the V40 supports rewind and resume of MP3 files. My googling turned up no quick wins so I posted a question on SuperUser. The answer lead me to the following post The Persistent Weblog from which, I took the following PowerShell:

$feed=[xml](New-Object System.Net.WebClient).DownloadString("http://developeronfire.com/rss.xml")
foreach($i in $feed.rss.channel.item)
    $url = New-Object System.Uri($i.enclosure.url)
    $file = "D:\DoF\" + $url.Segments[–1]
    if (! (Test-Path $file))
        (New-Object System.Net.WebClient).DownloadFile($url, $file)
Write-Host "Script finished. Press any key to continue …"
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")