Using Hazel to run a Handbrake script. Not working

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Hi

I have slightly changed the ATV2 preset in Handbrake so that the fps is "Same as Source" and not 29.97. Everything else is the same. I have called this preset 720HD.

I am using hazel to run a script that should run this preset in the CLI program. But its not working. Can anyone advise from this setup, what could be going wrong please.


Code: Select all
--Start the conversion
         set shellCommand to "nice /Applications/HandBrakeCLI -i " & origFilepath & " -o " & newFilepath & " --preset=\"720HD\" ;"
         do shell script shellCommand


The handbrake guide says that i should be able to call the preset like this

--preset="Preset Name"

So i have tried removing the "\" from the script, but its not working and i cannot save the hazel rule until i fix the script.

Any ideas?

Thanks for reading.
Chuggett
 
Posts: 30
Joined: Wed Mar 16, 2011 9:17 pm

If you are just using a shell script, you should use the shell script action instead of wrapping it in an AppleScript. Just paste in the script like this:

nice /Applications/HandBrakeCLI -i "$1" -o "newFilepath" --preset="720HD"

though you still need to fill in what newFilePath is.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks Mr Noodle.

Im now starting to show my inexperience, as im not sure what you meant in your reply. I have tried to replace my script with yours and i am getting a Rule error and it highlights the " before the $. This is how it now reads
Code: Select all
--Start the conversion
         set shellCommand to nice /Applications/HandBrakeCLI -i "$1" -o "newFilepath" --preset="HD"
         do shell script shellCommand



basically, i have copied the script of another hazel user and have tried to adapt it to my scenario. The entire script is here.
Code: Select all
try
   tell application "Finder"
      try
         --Set to red label to indicate processing
         set label index of theFile to 2
         
         --Assemble original and new file paths
         set origFilepath to quoted form of POSIX path of (theFile as alias)
         set newFilepath to (characters 1 thru -5 of origFilepath as string) & "m4v'"
         
         --Start the conversion
         set shellCommand to nice /Applications/HandBrakeCLI -i "$1" -o "newFilepath" --preset="HD"
         do shell script shellCommand
         
         --Set the label to orange
         set label index of theFile to 5
      end try
   end tell
   tell application "Finder"
      set movieName to name of item theFile
   end tell
   tell application "GrowlHelperApp"
      set the allNotificationsList to {"Handbrake convert complete"}
      set the enabledNotificationsList to {"Handbrake convert complete"}
      register as application "Handbrake Encode Growler" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "HandBrake"
      notify with name "Handbrake convert complete" title "Handbrake conversion complete" description "The video \"" & movieName & "\" has been converted." application name "Handbrake Encode Growler"
   end tell
end try


Thanks for helping
Chris
Chuggett
 
Posts: 30
Joined: Wed Mar 16, 2011 9:17 pm

My script is a shell script so you want to use the shellscript action, not AppleScript. Basically, what your script fragment is doing is telling AppleScript to call a shell script which is an extra step that isn't needed. Try pasting my script as is into the shell script action and see if that works for you.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support