Skip

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!

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.

This 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:
  1. Get Specified Finder Items: [name of folder]
  2. Get Folder Contents
  3. Set Name of Variable: filename
  4. 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?
  5. Run Shell Script: My plan, once I had the filename by itself, was to do something like this:
    for f in "$@"
    do
    	echo '~/Applications/HandbrakeCLI -i [original folder path]/$f -o [new folder path]/f.mp4 --preset="iPhone & iPod Touch"'
    done
    which would convert and move the file.
  6. 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?
posted by joshuaconner to Computers & Internet (4 answers total) 1 user marked this as a favorite
 
I had something similar running a while ago. The tools I mention may have changed or been updated since then: http://david.ely.fm/post/384004519/automatically-converting-avi-and-mkv-videos-into-an
posted by davextreme at 1:59 PM on October 8, 2010


Breakfast seemed like exactly what I was looking for! I downloaded it, started it up, set the relevant details, and...nothing. Does it run only in the middle of the night? I'm not sure, but I'll leave it until tomorrow and hope for the best.

The main page for Breakfast also notes that it is no longer in active development, but recommends The Transcoding Machine, which crashes on me whenever I try to change the source directory or turn monitoring on (apparently a known issue). (That's a too-long way of saying it doesn't work, which is a bummer.)
posted by joshuaconner at 3:10 PM on October 8, 2010


Looks like you're on the right path. (no pun intended)

The trim command looks to be a convenience string function. There is certainly other string handling possibilities, and working with strings can be nitpicky and frustrating. What I do is build a small trial script that just reads an example path, extracts filename and just prints the output. Then do the tweaking on that working script, cycle a few (hundred:) times and when the function works, integrate into the main script.
posted by sammyo at 10:32 AM on October 9, 2010


Finally I got frustrated with Automator and downloaded Hazel. While it's not free, it is way more intuitive (to me at least) than Automator, and has some useful commands (like "Import into iTunes") that you can't do in Automator without writing AppleScripts.

I posted more details about exactly how I did it over in their support forums, after the guy who makes Hazel answered my question and got me on the right track.
posted by joshuaconner at 1:30 AM on October 12, 2010


« Older I'm going to be starting a lit...   |  Where is the best information ... Newer »
This thread is closed to new comments.


Post