Hazel and Handbrake CLI Script Problem

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

Moderator: Mr_Noodle

Hazel and Handbrake CLI Script Problem Mon Nov 24, 2014 2:45 pm • by BCMielke
I've spent most of the morning trying to troubleshoot this without much, well no, progress.

I am attempting to take a transport video file (.ts) and encode it with Handbrake CLI. I have had success in the Terminal widow, but when I put a script in Hazel I have gotten the same error.

My script is set up this way:

If all of the following are met:
Name Contains 720p
Extension is ts

Do the following to the matched file or folder
Run shell script (embedded script)

I know that Hazel is finding the file fine, but the script seems to be an issue. When I searched the forum I found and modified for my system the below script.

filename=$(basename "$1")
filename=${filename%.*}
converting_directory=“Boot HD/Users/chrismielke/Documents/EyeTV Archive/”
output_directory="/Boot HD/Users/chrismielke/Documents/EyeTV Archive/“
converting_filenameHD="$converting_directory$filename (HD).m4v"

/applications/HandBrakeCLI -i "$1" -o "$converting_filenameHD” -f mp4 -4 --decomb -w 1920 -l 1080 --loose-anamorphic --modulus 2 -e x264 -q 20 -r 30 --pfr -a 1 -E faac -6 dpl2 -R Auto -B 160 -D 0 --gain 0 --audio-fallback ffac3 --x264-profile=high --h264-level=4.0

When I run the above I get the following from the Hazel log.

2014-11-24 12:44:04.168 hazelworker[45111] Motion - Denali 720p.ts: Rule Convert TS Files using Handbrake matched.
2014-11-24 12:44:04.199 hazelworker[45111] [Error] Shell script failed: Error processing shell script on file /Users/chrismielke/Documents/EyeTV Archive/Motion - Denali 720p.ts.
2014-11-24 12:44:04.199 hazelworker[45111] Shellscript exited with non-successful status code: 1
2014-11-24 12:44:12.333 hazelworker[45111] Motion - Denali 720p.ts: Rule Convert TS Files using Handbrake matched.
2014-11-24 12:44:12.382 hazelworker[45111] [Error] Shell script failed: Error processing shell script on file /Users/chrismielke/Documents/EyeTV Archive/Motion - Denali 720p.ts.
2014-11-24 12:44:12.382 hazelworker[45111] Shellscript exited with non-successful status code: 1

Any thoughts on what the issue is?
BCMielke
 
Posts: 3
Joined: Mon Nov 24, 2014 2:36 pm

Re: Hazel and Handbrake CLI Script Problem Mon Nov 24, 2014 4:57 pm • by Mr_Noodle
Try turning on debug mode as indicated in the sticky article near the top of the forum. Also, check to see if your script requires any environment variables to be set as that's a common source of errors. Running scripts in Hazel is a different context than doing it in Terminal and you can't assume the environment will be the same.
Mr_Noodle
Site Admin
 
Posts: 11262
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Hazel and Handbrake CLI Script Problem Mon Nov 24, 2014 6:35 pm • by BCMielke
Thanks, I was able to turn on debug mode, however for me the error log wasn't much help.

2014-11-24 16:32:03.352 HazelHelper[577] DEBUG: Thread 0x638000075a00: Received events (
{
date = "2014-11-24 22:32:03 +0000";
path = "/Users/chrismielke/Documents/EyeTV Archive/";
shouldDoFullScan = 0;
}
) for stream at path: /Users/chrismielke/Documents/EyeTV Archive
2014-11-24 16:32:03.353 HazelHelper[577] DEBUG: Thread 0x638000075a00: Run worker for folder: /Users/chrismielke/Documents/EyeTV Archive
2014-11-24 16:32:03.353 HazelHelper[577] DEBUG: Task already running for folder: /Users/chrismielke/Documents/EyeTV Archive
BCMielke
 
Posts: 3
Joined: Mon Nov 24, 2014 2:36 pm

Re: Hazel and Handbrake CLI Script Problem Tue Nov 25, 2014 8:09 am • by BCMielke
It appears that I have it working now. I guess I will eat some crow and say that the DeBug mode did help. :)

Since it appeared that things were already open I rebooted and after the reboot things started working fine.
BCMielke
 
Posts: 3
Joined: Mon Nov 24, 2014 2:36 pm

Re: Hazel and Handbrake CLI Script Problem Tue Nov 25, 2014 2:06 pm • by Mr_Noodle
It appears the process might have been stuck from before? I'd keep an eye on it. If it happens again, select the process in Activity Monitor and do "Sample Process" on it and send it in.
Mr_Noodle
Site Admin
 
Posts: 11262
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support