Looks like gPodder already has a built-in extension which does this. No need to download it as it's included.
- Click gPodder > Preferences.
- Click the Extensions tab.
- Check the box next to Rename episodes after download.
- Click the Edit config button on the bottom-right of the preferences window.
- Check the box next to extensions.rename_download.add_sortdate.
- Close remaining windows.
All future-downloaded podcast filenames should then be prefixed with "YYYY-MM-DD -".
Optionally, you can also enable extensions.rename_download.add_podcast_title to prepend the title to the filename too.
You could also use the following PowerShell to rename existing files:
#
# PrependDateToPodcasts.ps1
#
Param (
[Parameter(Mandatory=$true, Position=0)][string]$FeedURL,
[Parameter(Mandatory=$true, Position=1)][string]$Directory,
[Parameter()][switch]$DryRun = $false
)
$XML = Invoke-WebRequest $FeedURL
$Podcasts = ($XML | Select-Xml "rss/channel/item").Node
$Podcasts | ForEach-Object {
$Filename = Split-Path $_.enclosure.url -Leaf
$Date = [datetime](($_.pubDate -replace " [A-Z]{3}$", "") -replace "^\w{3}", "") | Get-Date -Format "yyyy-MM-dd"
$FilePath = Join-Path $Directory $Filename
$FilenameNew = "${Date} - ${Filename}"
if (Test-Path $FilePath) {
Write-Host "Renaming `"${Filename}`" to `"${FilenameNew}`"."
if (!$DryRun) {
Rename-Item $FilePath $FilenameNew
}
}
}
# Preview changes before actually running.
.\PrependDateToPodcasts.ps1 "http://files.libertyfund.org/econtalk/EconTalk.xml" "C:\path\to\gPodder\Downloads\EconTalk" -DryRun
# Rename for real.
.\PrependDateToPodcasts.ps1 "http://files.libertyfund.org/econtalk/EconTalk.xml" "C:\path\to\gPodder\Downloads\EconTalk"