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:
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:
Looks like gPodder already has a built-in extension which does this. No need to download it as it's included.
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
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP