[Mac] Folder Action with Automator

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
Post Reply
User avatar
rednoah
The Source
Posts: 11536
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

[Mac] Folder Action with Automator

Post by rednoah » 29 Jun 2016, 11:17

Mac OS X Automator is a great built-in tool for automating various tasks. Making custom context menus for Finder (i.e. Service) and watching folders for new files (i.e. Folder Action) for console tools like FileBot is straight-forward.


Folder Action: Automated Media Center

In this example we will use Automator to watch a given folder for new files and pass them on to FileBot: Automated Media Center for processing.

  1. Make sure that the filebot console tools are installed and working:

    Code: Select all

    /usr/local/bin/filebot -version
  2. Start Automator, click New Document and select Folder Action to create a new workflow
  3. Click the Choose folder combobox and select the folder you want to watch
  4. Drag a Run Shell Script (Utilities) action into your workflow
  5. Set the Pass input combobox to as arguments
  6. Paste following filebot command into your shell script workflow:

    Code: Select all

    /usr/local/bin/filebot -script fn:amc --output "$HOME/Media" --action duplicate --conflict skip -non-strict --log-file amc.log --def excludeList=".excludes" unsorted=y music=y artwork=y "$@"
  7. Save your new workflow and close Automator
  8. Done! Newly added files will be processed fully automatically!

Finder Service: Automated Media Center

It's pretty much the same the above. I'll leave it as an exercise for the reader. ;)

Image
My (very excellent) support depends on Windows Store and Mac App Store sales and PayPal donations. Paying users, donors and everyone who contributes to FileBot in one way or another will get the very best support.

Image

Please read the FAQ and How to Request Help. Donate if you'd like some extra developer love. :ugeek:

Santaspascuas
Posts: 2
Joined: 24 Apr 2017, 13:50

Re: [Mac] Folder Action with Automator

Post by Santaspascuas » 24 Apr 2017, 13:55

Hi,

I have followed all your steps, and when I run the Automator I get the following error message: "Illegal usage: output folder must exist and must be a directory: "Media".

I have a folder called Media (users/alvaro/Media) *alvaro is my name
Can you help me with this issue? It is my first time writing scripts and I have no clue of the proper spelling of the output route.
Thanks!

User avatar
rednoah
The Source
Posts: 11536
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Mac] Folder Action with Automator

Post by rednoah » 24 Apr 2017, 13:59

Thanks for the post! Before a real human comes by, please make sure your report has all the following points checked:
  • What are you trying to do achieve? What's not working? What have you tried so far?
  • Include screenshots, logs or filenames (i.e. demonstrate the issue)
  • Include basic information (i.e. sysinfo output)
:idea: Please read How to Request Help and Fix Problems, Report Bugs, Get Features
My (very excellent) support depends on Windows Store and Mac App Store sales and PayPal donations. Paying users, donors and everyone who contributes to FileBot in one way or another will get the very best support.

Image

Please read the FAQ and How to Request Help. Donate if you'd like some extra developer love. :ugeek:

Santaspascuas
Posts: 2
Joined: 24 Apr 2017, 13:50

Re: [Mac] Folder Action with Automator

Post by Santaspascuas » 27 Apr 2017, 13:48

Hi rednoah, apologies for the lousy help request. I have now read the FAQ and the How to Request Help section. I am sorry if I still make mistakes, because I am not English fluent and I dont understand many of the words and instructions. Here I go:
I am running automator on a Mac Mini, runnin OS Sierra 10.12.4.
I am trying to set Automator to look up the destination folder of Transmission (called "Transmission"), where all the movies and tvshows are dowloaded, and process the media files through Filebot to rename them and send them to the Media folder.
Hopefully, in a second stage I would like to send the renamed files to external hard drives and even get the subtitles, but I dont want to bother you even further.
I have installed the filebot console tools and checked that are working.
When I follow the instructions given by you in this post, I open Automator, I select new Document and select Folder Action.
I click the Choose folder combobox and select the folder "Transmission"
When I paste the shell script arguments exactly as you say ("$HOME/Media"), I get the following error: http://i.imgur.com/ALOgN6r.png
If I write another route (/Users/alvaro/Media), the message is similar (quoting and unquoting): http://i.imgur.com/CAHmOX6.png

I hope I've provided enough information.
Many thanks in advance!

User avatar
rednoah
The Source
Posts: 11536
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Mac] Folder Action with Automator

Post by rednoah » 27 Apr 2017, 13:51

:!: It's a very bad idea to watch active download folders for changes. This could not possibly end well.

The best solution is to have Transmission call FileBot on completed downloads. Here's the setup instructions for that:
viewtopic.php?f=4&t=215#p3380
My (very excellent) support depends on Windows Store and Mac App Store sales and PayPal donations. Paying users, donors and everyone who contributes to FileBot in one way or another will get the very best support.

Image

Please read the FAQ and How to Request Help. Donate if you'd like some extra developer love. :ugeek:

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests