Geeks With Blogs

Lance's TextBox » About Me » My Resume »Twitter

“Quintas" was another of the winners of the PowerScripting Podcast’s NetCmdlets scripting contest.

Quintas submitted an espn-download script, which retrieves podcast feeds from espn.com and downloads the mp3 files for later listening.

Here is Quintas’ script:

# ESPN-Download  param($DownloadDir=$(throw "Usage:  ESPN-Download.ps1 DownloadDirectory Show LatestorAllDownloaded`nShows`n1. Mike & Mike`n2. PTI`n3. Around The Horn`n`n[L] for latestshow or [ A ] for All shows`n"),
[string]$ESPNShow=$(Read-Host "Enter number of the ESPN Radio Show you want to download: `n1. Mike & Mike`n2. PTI`n3. Around The Horn`n"),
[string]$numberDownloads=$(Read-Host "Enter [ L ] to download just the latest show or [ A ] to download all in the feed`n") )

switch ($ESPNShow)
{
1 { $rss = get-rss -Feed http://sports.espn.go.com/espnradio/podcast/feeds/itunes/podCast?id=2445552 }
2 { $rss = get-rss -Feed http://sports.espn.go.com/espnradio/podcast/feeds/itunes/podCast?id=2406595 }
3 { $rss = get-rss -Feed http://sports.espn.go.com/espnradio/podcast/feeds/itunes/podCast?id=2839445 }
}

switch ($numberDownloads)
{
"A" {
Foreach ($feed in $rss)
{
$title = $feed.Title
$title = $title.Replace('/','-')
$title = $title.Replace(':','-')
$fname = "$title.mp3" $filename = "$DownloadDir\$fname" Write-Output "Downloading $filename" (New-Object System.Net.WebClient).DownloadFile($url,"$filename")
}# Foreach } default {
$title = $rss[0].Title
$title = $title.Replace('/','-')
$title = $title.Replace(':','-')
$title = $title.Replace(" ","")
$fname = "$title.mp3" $filename = "$DownloadDir\$fname" Write-Output "Downloading $filename" (New-Object System.Net.WebClient).DownloadFile($url,"$filename")
}
}
Technorati Tags: ,
Posted on Thursday, September 11, 2008 4:46 PM PowerShell | Back to top


Comments on this post: PowerShell: ESPN-Download

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Lance Robinson | Powered by: GeeksWithBlogs.net