Jump to content

Would like to automate multi-step process with Alfred


Recommended Posts

New to Alfred, new to Workflows, but developer by trade.  Working on a Mac Pro running OS X 10.11 (El Capitan)

I would like to automate as much of a multi-step manual process as possible.  I have read through Alfred documentation and User Forums, but have not found, or may not have recognized what I am looking for.  I have developed bash shell scripts for several steps, a Python script for one step, and an Alfred workflow for one step. Indicated in the description of the manual workflow below with <bash>, <python> and <Alfred>.  

 

GOAL: I'm hoping Alfred will allow me to string them all together in a single workflow (or, at least, a small number of workflows).  Any help and/or advice will be greatly appreciated.

Here's the manual process:

1. Move .mov file from /Movies folder to /1-To-Be-Converted folder <bash>

2. Convert .mov file in 1-To-Be-Converted folder to .mp4 file using Compressor <Alfred workflow> - but, file(s) to be converted must be highlighted in Finder, therefore, human involvement required

3. Move .mov file from 1-To-Be-Converted folder to 2-Converted folder <bash>

4. Move .mp4 file from 1-To-Be-Converted folder to 3-Move-To-Plex folder <bash>

5. Secure copy .mp4 file from 3-Move-To-Plex folder to personal folder on another machine on same network used as Plex Media Server <bash>

6. Move .mp4 file from 3-Move-To-Plex folder to 4-Moved folder <bash>

7. On the Plex Media Server machine, change ownership and mode of .mp4 files to desired settings, then move and rename .mp4 files to final name and destination <python>

 

Note that Plex wants files in the format of "The Movie Title (Year Released)".  Since space characters in file names can be difficult to deal with, I've chosen to convert those to a string of characters in step 1, then convert the string of characters back to spaces in step 7.

 

Is it feasible to think I can automate the whole manual process?  If so, how do I get the Alfred Workflow to wait for Compressor to finish converting the .mov to .mp4 file format?  Once the .mp4 file gets scp'd to the Plex server, is there any way that the original Alfred Workflow could perform step 7 through a secure shell, or something similar?  Any other suggestions or gotchas would be greatly appreciated.

Thx

 

Edited by RLMason
Correct misspelling
Link to comment
On 20/02/2017 at 6:05 PM, RLMason said:

Mac Pro running OS X 10.11 (El Capitan)

 

Mac too old for Sierra, and you don't like the trashcan Mac?

 

On 20/02/2017 at 6:05 PM, RLMason said:

Since space characters in file names can be difficult to deal with, I've chosen to convert those to a string of characters in step 1, then convert the string of characters back to spaces in step 7.

 

 

That's only usually a problem with developer tools and badly-written shell scripts, tbh.

 

I use Hazel for moving video files around (encode MKVs in folder1 to MP4s in folder2; move MP4s in folder2 to folder3). Hazel can tell if a file is in use by native APIs and will wait till it's closed. That doesn't work with HandBrakeCLI, for example, so I use the rule "ends with .mp4 and last modified is more than 5 minutes ago".

 

I have an Alfred File Action to encode selected videos to folder2, whereupon Hazel takes over.

 

If you just want to watch a few folders and don't need Hazel's other features, you can use a Launch Agent or Folder Action to trigger your script, or use a library like MacFSEvents (Python) to access native FS events from your script.

 

You can also run an Alfred workflow from outside Alfred using External Triggers.

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...