TransWikia.com

How can I add a release date of a podcast to the filename or file metadata?

Super User Asked by user293098 on November 4, 2021

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

One Answer

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:pathtogPodderDownloadsEconTalk" -DryRun

# Rename for real.
.PrependDateToPodcasts.ps1 "http://files.libertyfund.org/econtalk/EconTalk.xml" "C:pathtogPodderDownloadsEconTalk"

Answered by Luke Humberdross on November 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP