Using Automator to convert videos for iPhone and add to iTunes
October 8, 2010 1:53 PM Subscribe
I'm trying to make an Automator folder action that - when a video is downloaded to said folder - will convert a video with HandbrakeCLI and add said converted video to iTunes, and I'm having some trouble. To say the least!
posted by joshuaconner to computers & internet (4 answers total) 1 user marked this as a favorite
I'm running a 13" MacBook Pro on Snow Leopard.
I found this
, but 1) I think it will cause and infinite loop if made into a folder action, 2) it doesn't send the files to iTunes.
looks super awesome but when I copy-and-pasted that code into Automator, it didn't do anything.
So I tried to make my own! (This is my first time doing anything with Automator.) My workflow looked like this:
- Get Specified Finder Items: [name of folder]
- Get Folder Contents
- Set Name of Variable: filename
- Run AppleScript: This is where I ran into trouble. My plan was to make an AppleScript that would trim the "path" part of $filename, leaving only the actual filename, but I couldn't for the life of me figure out how to do this, as trim_line is apparently no longer an AppleScript command?
- Run Shell Script: My plan, once I had the filename by itself, was to do something like this:
for f in "$@"
echo '~/Applications/HandbrakeCLI -i [original folder path]/$f -o [new folder path]/f.mp4 --preset="iPhone & iPod Touch"'
which would convert and move the file.
- Do something to add the files to iTunes. I couldn't figure this part out either.
What did I do wrong? How can I make this work? Is Automator even the right tool for this job?