Hazel and Handbrake CLI error

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

Moderator: Mr_Noodle

Hazel and Handbrake CLI error Tue Mar 12, 2013 8:23 am • by tscibilia
Hey, i've recently been getting an error with my Hazel workflow for TVs and Movies http://www.noodlesoft.com/forums/viewtopic.php?f=4&t=1885

Code: Select all
2013-03-12 08:18:16.426 hazelworker[91403] SOME-TV-OR-MOVIEFILE.avi: Rule Run Handbrake CLI matched.
2013-03-12 08:18:16.488 hazelworker[91403] [Error] AppleScript failed: Error executing AppleScript on file /Volumes/home/Torrents/Downloaded/!PROCESSING/1.0 TV Shows - Handbrake/SOME-TV-OR-MOVIEFILE.avi.
2013-03-12 08:18:16.488 hazelworker[91403] AppleScript error: {
    NSLocalizedDescription = "The variable origFilepath is not defined.";
    NSLocalizedFailureReason = "The variable origFilepath is not defined.";
    OSAScriptErrorAppAddressKey = "<NSAppleEventDescriptor: null()>";
    OSAScriptErrorBriefMessageKey = "The variable origFilepath is not defined.";
    OSAScriptErrorMessageKey = "The variable origFilepath is not defined.";
    OSAScriptErrorNumberKey = "-2753";
    OSAScriptErrorOffendingObjectKey = "<NSAppleEventDescriptor: 'utxt'(\"origFilepath\")>";
    OSAScriptErrorRangeKey = "NSRange: {0, 0}";
}
tscibilia
 
Posts: 11
Joined: Fri Dec 21, 2012 12:55 am

Re: Hazel and Handbrake CLI error Tue Mar 12, 2013 12:31 pm • by Mr_Noodle
Have you tried the script outside of Hazel (against the same file)? Also, have you installed anything that installs AppleScript extensions (.osax)?
Mr_Noodle
Site Admin
 
Posts: 8410
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Hazel and Handbrake CLI error Tue Mar 12, 2013 12:32 pm • by a_freyer
That error says that the variable origFilePath is not defined. Check your script to be sure you have declared and set this variable.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Hazel and Handbrake CLI error Tue Mar 12, 2013 7:10 pm • by tscibilia
Mr_Noodle wrote:Have you tried the script outside of Hazel (against the same file)? Also, have you installed anything that installs AppleScript extensions (.osax)?


the latest things ive installed were:
turbotax, instashare, doo, owncloud, and drive genius

i don't think they installed .osax files, but how can i be sure?
tscibilia
 
Posts: 11
Joined: Fri Dec 21, 2012 12:55 am

Re: Hazel and Handbrake CLI error Tue Mar 12, 2013 8:00 pm • by tscibilia
a_freyer wrote:That error says that the variable origFilePath is not defined. Check your script to be sure you have declared and set this variable.


I see that but i don't know how to fix it. like i said it use to work fine.

I got the script from here...viewtopic.php?p=3447#p3447
tscibilia
 
Posts: 11
Joined: Fri Dec 21, 2012 12:55 am

Re: Hazel and Handbrake CLI error Wed Mar 13, 2013 11:50 am • by Mr_Noodle
Check Library/ScriptingAdditions (both in your home folder and at the root of your drive). Again, though, you should try running the script outside of Hazel to confirm it works, making sure to run it against the same file that is giving you the error.
Mr_Noodle
Site Admin
 
Posts: 8410
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Hazel and Handbrake CLI error Wed Mar 13, 2013 11:52 am • by a_freyer
The line...

Code: Select all
         set origFilepath to quoted form of POSIX path of (theFile as alias)


...is likely what is causing the problem.

I anticipate that you are potentially sending a folder, or something similar to the script, causing origFilepath to be (null).

What are the rule conditions you have for this particular rule? To you include only certain file types? This this rule part of a "run rules on folder contents" group?
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Hazel and Handbrake CLI error Wed Mar 13, 2013 3:04 pm • by AdamRoxby
I have had no luck in getting HandBrake CLI to convert movies.

I wanted it to convert my iPhone videos that are just too big and can be rendered down without loosing quality.

While doing some searching I found that a lot of people were using this program called HandBrakeBatch. What do people think to this as a solution?

http://www.osomac.com/apps/osx/handbrake-batch/
AdamRoxby
 
Posts: 47
Joined: Tue Oct 30, 2012 8:56 am

Re: Hazel and Handbrake CLI error Wed Mar 13, 2013 3:13 pm • by a_freyer
Depends on whether this has a command line interface or an applescript dictionary. Either?
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Hazel and Handbrake CLI error Wed Mar 13, 2013 8:35 pm • by tscibilia
a_freyer wrote:The line...

Code: Select all
         set origFilepath to quoted form of POSIX path of (theFile as alias)


...is likely what is causing the problem.

I anticipate that you are potentially sending a folder, or something similar to the script, causing origFilepath to be (null).

What are the rule conditions you have for this particular rule? To you include only certain file types? This this rule part of a "run rules on folder contents" group?


Oddly enough you helped me get this procedure working a while back. here's my current set of rules viewtopic.php?f=4&t=1885#p7797

One last bit of info. all these files are on my networked synology drive that I mount to via afp://



1.0 TV Shows - Handbrake
Run Handbrake CLI
• If <all> conditions met for <the file or folder being matched>
<Date Added> is after <Date Last Matched>
<Extension> is not <m4v>
• Do the following
<Run AppleScript>
Code: Select all
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 " & origFilepath & " -o " & newFilepath & " --preset=\"AppleTV 3\" ;"
      do shell script shellCommand
      --Set the label to orange
      set label index of theFile to 3
   end try
end tell
tell application "Finder"
   set movieName to name of item theFile
end tell
tell application "Growl"
   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"
   --Remove the old file
   set shellCommand to "rm -f " & origFilepath
   do shell script shellCommand
end tell

Move to be Renamed (This works, but I'm not sure how low I can make the trigger such as 3 mins?)
• If <all> conditions met for <the file or folder being matched>
<Extension> is <m4v>
<Date Last Modified> is not in the last <30 minutes>
• Do the following
<Move> to folder <2.0 TV Shows - Rename>
tscibilia
 
Posts: 11
Joined: Fri Dec 21, 2012 12:55 am

Re: Hazel and Handbrake CLI error Wed Mar 13, 2013 8:39 pm • by a_freyer
Edit -removed as unrelated
Last edited by a_freyer on Thu Mar 14, 2013 8:19 am, edited 1 time in total.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Hazel and Handbrake CLI error Wed Mar 13, 2013 10:26 pm • by tscibilia
i honestly have no idea, i got that script from here...viewtopic.php?p=3447#p3447

and i saw it being used here to...https://forum.handbrake.fr/viewtopic.ph ... zel#p70244


how can i "define origFilepath"
I'm confused because i never ran into this problem before. If i wanted to test this applescript outside of hazel (like in automator) i get a window that looks like this...how would i edit it to test the applescript because i get an error "variable theFile is not defined"
Code: Select all
on run {input, parameters}
   
   (* Your script goes here *)
   
   return input
end run
tscibilia
 
Posts: 11
Joined: Fri Dec 21, 2012 12:55 am

Re: Hazel and Handbrake CLI error Wed Mar 13, 2013 10:29 pm • by a_freyer
Edit - removed as unrelated
Last edited by a_freyer on Thu Mar 14, 2013 8:19 am, edited 1 time in total.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Hazel and Handbrake CLI error Thu Mar 14, 2013 8:14 am • by tscibilia
i didn't try it in automator. coincidentally i was have other troubles with my network drives and found out that my Media drive was actually Media-1 and after i cleared my Library caches, unmounted everything in my Volumes folder and restarted. I tested the same old script through Hazel and it worked fine.

so does anyone know how to prevent network folders from mounted with the apprendix "-1"?
tscibilia
 
Posts: 11
Joined: Fri Dec 21, 2012 12:55 am

Re: Hazel and Handbrake CLI error Fri Mar 15, 2013 12:49 pm • by Mr_Noodle
It would happen if there was another drive already mounted as "Media". Otherwise, not sure what is going on there.
Mr_Noodle
Site Admin
 
Posts: 8410
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support