Force Hazel to rerun rules that have previously matched

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

Moderator: Mr_Noodle

Short version of my question: Is there a way to force Hazel to re-run a rule on a file that it's already matched?

Long version:
I use Hazel with HandBrakeCLI to convert downloaded movies and import them to iTunes. Left to its own devices, HandBrakeCLI takes all the available CPU, so I use a program called cputhrottle to limit the amount of cpu HandBrakeCLI can get. For cputhrottle to work properly, I only want one instance of HandBrakeCLI running at a time—so I effectively have to queue my movie downloads.

To make this work, I'm using Hazel to run an AppleScript that does the following:
if HandBrakeCLI is not running:
run HandBrakeCLI on this file;
else:
change the file's color label to green.

EDIT: I should add that I'm running HandBrakeCLI in the background, by appending " &" to the shell command, to allow Hazel to continue processing other files in my Downloads folder while HandBrakeCLI is running.

The script works as described. Then Hazel matches the file with an "if label is green" rule and runs the script again. But if HandBrakeCLI is still running, Hazel won't match the file a third time, so it just sits around, greenly, waiting to be converted.

Is there a way to force Hazel to keep matching a file? Or Can anyone think of a better approach for my problem?
saagpaneer
 
Posts: 4
Joined: Wed Nov 11, 2009 7:20 pm

You need some change in conditions to have Hazel re-match the file.

Maybe a better approach is to have another folder for Handbrake processing and have Hazel monitor that and run Handbrake on the files, but not in the background. Since that Hazel instance will be dedicated to that one folder, it won't block processing on other folders.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Good suggestion—I'll investigate.
saagpaneer
 
Posts: 4
Joined: Wed Nov 11, 2009 7:20 pm

In my long "perfect process" post you can see what i do and the scripts i use. I do the same thing where i limit HBCLI but i find that one instance does not have a dramatic affect on my computer and hazel. I let 3 run at one time. Nonetheless, i guess i don't quite understand the problem. For example, i download a file, move it to a conversion folder. Once in that folder, my script tells HB to run. If 10 movies are added over say a 5 min period, only 3 HBCLIs can ever be run at once. All the HBs are set to convert into another folder I call Converted. When they are finished, I change their color to Green. Once Green, i run a tagging script.

Never have issues with Hazel throughout this process. I guess help me understand where your process is falling down.
dhy8386
 
Posts: 96
Joined: Tue Nov 09, 2010 12:19 pm

dhy8386: I hadn't seen your thread when I started on this—it probably would have saved me a bunch of time!

In my experience, when HandBrakeCLI is running it uses all the available CPU—the graph on Activity Monitor goes right to the top. If I'm using the computer for something else, everything gets slowed down. So I use cputhrottle to cut HandBrakeCLI down to 35% of the CPU, and although the conversion takes longer, I can use the machine in the meantime.

The problem I was having was with my approach to scripting ... I wanted to use AppleScript to effectively create a queue for my HandBrakeCLI conversions. There's probably a way to do this, but I hadn't found it. In any case, following Mr. Noodle's suggestion I'm now using a separate folder for video downloads, which effectively creates the queuing behavior I was looking for.
saagpaneer
 
Posts: 4
Joined: Wed Nov 11, 2009 7:20 pm


Return to Support