How to convert all your podcast for your ipod in a single click

I was looking at DropFolders (http://inflagrantedelicto.memoryspiral.com/2010/06/now-available-air-2-0-handbrake-preset-manager-dropfolders/) to convert all my podcasts. The software is cool but does not work with subfolders, so I came up the the simplest alternative possible. a powershell script.

Given the folder with your podcasts are in is c:users{username}podcasts, copy the file HandBrakeCLI.exe and libgcc_s_sjlj-1.dll in that folder (download the files from http://handbrake.fr/downloads2.php).

Then create a new powershell script as follow

$folders = get-childitem
#%{“from folder $folders”}
Get-ChildItem $folders  | Foreach {

if($_.Extension -eq ‘.mp4’ -or $_.Extension -eq ‘.wmv’ )
{
$input = New-Object system.IO.FileInfo $_.fullname
$inputdir =  $input.Directory
$output = New-Object system.IO.FileInfo $_.fullname.Replace(‘Podcasts’, ‘PodcastsEncoded’).Replace(‘.wmv’, ‘.mp4’)
$output.Directory.Create();
$outputdir = $output.Directory
$outputdir.Create()
$root = $inputdir.Parent
if(!$output.Exists)
{
%{“cd “”{0}””” -f $root.fullname}
%{“HandBrakeCLI.exe –input “”{0}”” –output “”{1}”” –preset=””iPod””” -f $_.fullname, $output.fullname}
}
}
} | out-File -filePath “convert.bat” -encoding “UTF8”

.convert.bat

and save it as convert.ps1

once you run the powershell script, it will create all the folders in c:users{username}PodcastsEncoded and a new convert.bat in the podcast folder. This is a necessary step to make handbrake work. it will crash if the destination folder does not exist and I want to preserve the folder structure.

You can the then run that bat file, and all your files will be automatically converted to a version that works on your ipod.
The important bits of the script are in bold; the first one(PodcastsEncoded ) is the folder where your files will be created, the second one (preset) is the type of conversion handbrake will use to convert your files. There are many others you can use, see https://trac.handbrake.fr/wiki/BuiltInPresets

The powershell script check if the file has already been converted (if it exist on the destination folder) and will skip it if it has already been.

This does not work if the file has been partially converted, but there’s not much I can do to avoid this or to verify if the file has totally been converted.

[Edit]

add

.convert.bat

at the bottom of the powershell script. it will run automatically the bat file.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s