Convert video using Visualhub

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

Moderator: Mr_Noodle

Convert video using Visualhub Fri Jan 09, 2009 10:07 am • by giantbraintrash
Hi,

I just downloaded Hazel yesterday (like it a lot) and played around with it, but I'm stuck. Maybe some of you wizards can help me?

What I'm trying to do: Have Hazel check a folder (and subfolders) for video files, convert them to Apple TV compliant H.264, add the files to iTunes (right now I'm doing this manually).

How I tried to do it: Have Hazel descend into the folder and it's subfolders (worked), check for movie files, use the Visualhub Automator action that can be found here to add the files to Visualhub, which then converts them and adds them to iTunes.

The problem I ran into: Only one file was added to Visualhub (the first one Hazel found), not all of them. When I changed the action from the Automator script to a Growl message displaying the file name, it showed all of them, so it seems to be a problem with the Automator action, right? Not that I know anything about that kind of stuff.

How can I solve this or work around it? (I don't necessarily need to use Visualhub, if someone has any other idea how to accomplish the task.)

Running it on Tiger (10.4.11)


Thanks for reading this, thank you even more if you can help. (Let me be clear, though, about my appreciation for just reading this even if you can't. I love you and may even consider marrying you. Thank you. Again.)


Bye,
Christian
giantbraintrash
 
Posts: 3
Joined: Thu Jan 08, 2009 5:30 pm

Re: Convert video using Visualhub Fri Jan 09, 2009 12:05 pm • by Mr_Noodle
I think the problem is that on Tiger, there's no way for Hazel to wait for the Automator workflow to finish (this problem was rectified by Apple in Leopard). So, when Hazel triggers the workflow, it continues while Automator is churning. I suspect what is happening is that Hazel is triggering it for the next file while Automator is still working on the first one and it can't do more than one at a time.

I suspect on Leopard things will just work but for Tiger, I think the only way to deal with it is to add a delay in Hazel. You can do something like add a shell script action right after the Automator one as follows:
Code: Select all
#!/bin/sh
sleep 30

That would just pause for 30 seconds. You can adjust the value as needed. Not the best solution but given the constraints, probably the easiest.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Convert video using Visualhub Fri Jan 09, 2009 2:52 pm • by giantbraintrash
Hi,

thanks for replying so quickly. The delay seems to do the trick for now. Maybe it IS time to move on to Leopard.

As you didn't take me up on that marriage thing, I guess we can settle on me buying your program :)


Thanks again,
Christian
giantbraintrash
 
Posts: 3
Joined: Thu Jan 08, 2009 5:30 pm

Re: Convert video using Visualhub Fri Jan 09, 2009 4:17 pm • by Mr_Noodle
If you are contemplating upgrading to Leopard and you want iLife and iWork, remember that Apple is putting out a box set of all three at the end of the month. Someone noted that if you pay full price for iLife and iWork, it's like getting Leopard for $10.

And yes, I think buying the program is sufficient.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Convert video using Visualhub Sat Mar 07, 2009 7:12 am • by giantbraintrash
Hi,

I finally upgraded to Leopard thinking that would get rid of the shell script workaround.

Well, it didn't - it actually blew up the whole workflow. The Automator workflow starts just fine, then an error message appears telling me the workflow failed (it seems to take too long for Automator to get back a result, so it assumes failure when actually in the background Visualhub is happily working its way through the file).

That seems to kill the Hazel workflow, so the wait period using the sleep command is never executed.

Is there any way around this? I actually don't care about the Automator error message (as it doesn't affect the one-step Automator workflow), but I would like Hazel to continue with the rule commands.


Thanks, any help is being appreciated,
Christian
giantbraintrash
 
Posts: 3
Joined: Thu Jan 08, 2009 5:30 pm

Re: Convert video using Visualhub Mon Mar 09, 2009 3:17 pm • by Mr_Noodle
How long does it take to run the action? If it is just "adding" it to VisualHub for it to be queued up to be processed, it should return immediately, right? If it is actually converting and forcing the caller to wait, the caller (in this case Hazel) is going to time out as it can't tell if the process is hung or actually doing work.

I think it may be better to break it up. Have one rule set things up and let the conversion happen in its own time. When the conversion is done, set up another rule to detect that and then do any post processing.

Using a shell script like the following (this is just typed in off the top of my head so may require tweaking):
Code: Select all
automator -i $1 <<your workflow path>> &


This will trigger the workflow in the background and return immediately. Of course, remember to replace the path to your workflow for the <<your workflow path>> part.

Now, I'm not sure how the workflow works. If the filesnames are changed or put into a separate folder then it should be easy. If not, then add an action to the workflow to color the file or add a comment to indicate when it's done. Then you can make a Hazel rule to pick that up and do whatever.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support