Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Community > MacNN Lounge > Scripting a Watch Folder for Handbrake

Scripting a Watch Folder for Handbrake
Thread Tools
subego
Clinically Insane
Join Date: Jun 2001
Location: Chicago, Bang! Bang!
Status: Online
Reply With Quote
Apr 4, 2023, 11:44 AM
 
This is way above my skill level. I’m expecting pain.

Just installed fswatch. The documentation is words words words.
     
subego  (op)
Clinically Insane
Join Date: Jun 2001
Location: Chicago, Bang! Bang!
Status: Online
Reply With Quote
Apr 4, 2023, 01:04 PM
 
Just occurred to me this might be more easily accomplished with Python.
     
subego  (op)
Clinically Insane
Join Date: Jun 2001
Location: Chicago, Bang! Bang!
Status: Online
Reply With Quote
Apr 4, 2023, 03:40 PM
 
Just realized this is way more complicated than I thought.

Monitoring a Mac’s file system doesn’t seem too hard, but the folder I want watched is on a network volume. What I actually need to do is monitor the file system on my server.

Back to square one. Probably for the best, though. It’s made me consider other options, and I think there’s one staring me right in the face which I should have been doing right from the start. I’ll report back.
     
reader50
Administrator
Join Date: Jun 2000
Location: California
Status: Offline
Reply With Quote
Apr 4, 2023, 05:42 PM
 
Must it notice immediately? You could script it once-a-minute, to pull the catalog of that folder. Parse for suitable file-types, and trigger Handbrake as needed. Might have to compare against the output folder, so you don't trigger for a file already done or in processing.
     
subego  (op)
Clinically Insane
Join Date: Jun 2001
Location: Chicago, Bang! Bang!
Status: Online
Reply With Quote
Apr 4, 2023, 06:41 PM
 
Right off the bat, that’s a much better and simpler way to do it than I was imagining.

However, it looks like the software I’m using to manage renders can be set to give an alert when a render has finished.

As a nice touch on the part of the developer, the alert itself is a user-editable terminal command. Should be easy to have that trigger Handbrake.
     
subego  (op)
Clinically Insane
Join Date: Jun 2001
Location: Chicago, Bang! Bang!
Status: Online
Reply With Quote
Apr 5, 2023, 09:57 AM
 
That surprisingly worked.

Surprisingly, because everything else I’ve tried over the last three days didn’t.
     
Laminar
Posting Junkie
Join Date: Apr 2007
Location: Iowa, how long can this be? Does it really ruin the left column spacing?
Status: Offline
Reply With Quote
Apr 10, 2023, 03:25 PM
 
Is this something that Automator can help with? I remember setting it up back in the day to monitor my Dropbox photo upload folder, then triggering a copy and resize of any photos as they're added.
     
subego  (op)
Clinically Insane
Join Date: Jun 2001
Location: Chicago, Bang! Bang!
Status: Online
Reply With Quote
Apr 11, 2023, 07:27 AM
 
I’ve avoided Automator because I’m assuming it’s only a matter of time before Apple does it dirty like they did AppleScript.

One of the issues with that method, or almost any method really, is I’d need to write logic (no… not Logic you fuckhead phone) to stop it from passing an unfinished render to Handbrake. Since the method I used is triggered internally by a “render complete” alert, it eliminates the need to build in a cooldown period to make sure the original file is no longer being modified.
( Last edited by subego; Apr 11, 2023 at 02:58 PM. )
     
subego  (op)
Clinically Insane
Join Date: Jun 2001
Location: Chicago, Bang! Bang!
Status: Online
Reply With Quote
Apr 25, 2023, 10:09 AM
 
Aaaaaand… just realized the company who makes my render management software decided to stop development. So, even though what I have now works, it’s only a matter of time before something breaks. As it stands now, it’s already forcing me to stay with After Effects 2022.

Safest plan is to eject this part of the workflow entirely and see if I can get distributed rendering and h264 encoding functionality natively.
     
reader50
Administrator
Join Date: Jun 2000
Location: California
Status: Offline
Reply With Quote
Apr 25, 2023, 01:53 PM
 
... or remain with the production OS version you're using, so nothing breaks at all. Worry about an altered render path when it's time to upgrade. Until then, keep the render farm disconnected from the internet for security. In a decade, when you need to upgrade your solution, you'll have more options to choose from. Or a competing product that can replace the abandoned one.
     
subego  (op)
Clinically Insane
Join Date: Jun 2001
Location: Chicago, Bang! Bang!
Status: Online
Reply With Quote
Apr 25, 2023, 02:18 PM
 
I’d actually be tempted to do that, but too many subscription based services which won’t work unless they can periodically phone home.
     
reader50
Administrator
Join Date: Jun 2000
Location: California
Status: Offline
Reply With Quote
Apr 25, 2023, 02:52 PM
 
SaS - ugh. I'd rebuild a render farm just to get rid of all that.
     
subego  (op)
Clinically Insane
Join Date: Jun 2001
Location: Chicago, Bang! Bang!
Status: Online
Reply With Quote
Apr 25, 2023, 03:14 PM
 
Originally Posted by reader50 View Post
SaS - ugh. I'd rebuild a render farm just to get rid of all that.
Actually, this has gotten me thinking I might be able to nuke one of my ridiculously overpriced filter suite subscriptions, so thank you for prompting the idea!
     
subego  (op)
Clinically Insane
Join Date: Jun 2001
Location: Chicago, Bang! Bang!
Status: Online
Reply With Quote
Apr 25, 2023, 03:32 PM
 
Originally Posted by reader50 View Post
keep the render farm disconnected from the internet for security.
On the subject of security risks, the revised workflow is going to force me to enable ssh.
     
subego  (op)
Clinically Insane
Join Date: Jun 2001
Location: Chicago, Bang! Bang!
Status: Online
Reply With Quote
May 14, 2023, 04:40 PM
 
Every python and shell script I’ve needed or thought I’d need to manage my render farm has fallen by the wayside. Whole thing runs on a simple macro now.

Silver lining is I get to disable ssh.
( Last edited by subego; May 14, 2023 at 05:21 PM. )
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 12:05 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,