4

I use gPodder to download podcasts.

For example, I have downloaded the podcasts for EconTalk and this is the first podcast:

enter image description here

gPodder tells me that this podcast was “Released” on “2006-03-16.”

How do I add this information (yyyy-mm-dd, "2006-03-16") to either the front of the file name or somewhere in the file’s metadata?

My goal is to do the same for all the podcasts I’ve downloaded and not just this particular one.


Currently, this yyyy-mm-dd information doesn’t seem to appear anywhere in the file's metadata:

enter image description here

1 Answer 1

2

Looks like gPodder already has a built-in extension which does this. No need to download it as it's included.

  1. Click gPodder > Preferences.
  2. Click the Extensions tab.
  3. Check the box next to Rename episodes after download.
  4. Click the Edit config button on the bottom-right of the preferences window.
  5. Check the box next to extensions.rename_download.add_sortdate.
  6. 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"
1
  • Good answer! But PowerShell is primarily a Windows tool. The screenshot shows what looks to me like a Windows interface, but I would recommend double checking with the original poster regarding what OS they are on. Jul 18, 2020 at 3:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.