List of All Possible Parameters for AMC Script's exec Option?

Support for Ubuntu and other Desktop Linux distributions
Post Reply
HarryMuscle
Posts: 3
Joined: 06 Jan 2022, 22:40

List of All Possible Parameters for AMC Script's exec Option?

Post by HarryMuscle »

Is there a list somewhere of all of the possible parameters that can be used in the AMC script's exec option which allows running code after an item has been processed? Here's what I'm trying to accomplish and I'm assuming using the exec option is the way to do it:

I have 4 folders:

Code: Select all

input
output
manual
completed
I have the AMC script setup to run every x minutes to check for anything in the input folder and place it in the output folder via hard links. Anything that it can't process goes to the manual folder via the unsorted and unsortedFormat options. Since I'm copying (technically hard linking) and not moving files (on purpose), I would like to place anything from the input folder that has been processed in the completed folder. I know there is the excludeList option that can be used to prevent processing items again that are still in the input folder, but that's not the only reason why I would like to move processed items to the completed folder.

In order to accomplish the above I assume the exec option will be the best approach, but I would need to know what parameters are available that can be passed to a script. The most important parameter that I would need is the original folder or file name of the item processed.

BTW, I also read that FileBot can store original filename information in extended attributes, unfortunately the file system I will be processing these on has those disabled, so I'm really hoping this information can be passed to the script via the exec option.

Thanks,
Harry
User avatar
rednoah
The Source
Posts: 20487
Joined: 16 Nov 2011, 08:59

Re: List of All Possible Parameters for AMC Script's exec Option?

Post by rednoah »

1.
-exec expressions work the same way as --format expressions. The former generates a String value that is an argument value, the latter generates a String value that is a file path.


:idea: You can find a list of top-level bindings here, some of which are complex objects with dynamic properties, but since you're generally writing code here, even if just a variable name, the possibilities are rather inifinite:
https://www.filebot.net/naming.html#bindings



2.
:?: I'm not actually clear what you're trying to do, and how -exec in particular would be the best way to go about that, but I can give you an example that passes all the relevant information onto your custom script:
rednoah wrote: 14 Sep 2019, 19:43

Code: Select all

-exec /path/to/script.sh {f} {historic.f} {json}
I'd start with a test script.sh for testing to see the variables that are passed along:

Code: Select all

#!/bin/sh -xu
echo "$1"
echo "$2"
echo "$3"

:!: Note that the amc script has it's own --def exec option which is distinct from -exec and although it can do the same thing, does work in a different way:

Code: Select all

--def exec="/path/to/script.sh {quote f, historic.f, json}"



3.
:idea: You can configure FileBot to write xattr metadata into a plain file structure instead:
https://www.filebot.net/help/xattr.html
:idea: Please read the FAQ and How to Request Help.
HarryMuscle
Posts: 3
Joined: 06 Jan 2022, 22:40

Re: List of All Possible Parameters for AMC Script's exec Option?

Post by HarryMuscle »

rednoah wrote: 07 Jan 2022, 01:25 1.
-exec expressions work the same way as --format expressions. The former generates a String value that is an argument value, the latter generates a String value that is a file path.


:idea: You can find a list of top-level bindings here, some of which are complex objects with dynamic properties, but since you're generally writing code here, even if just a variable name, the possibilities are rather inifinite:
https://www.filebot.net/naming.html#bindings



2.
:?: I'm not actually clear what you're trying to do, and how -exec in particular would be the best way to go about that, but I can give you an example that passes all the relevant information onto your custom script:
rednoah wrote: 14 Sep 2019, 19:43

Code: Select all

-exec /path/to/script.sh {f} {historic.f} {json}
I'd start with a test script.sh for testing to see the variables that are passed along:

Code: Select all

#!/bin/sh -xu
echo "$1"
echo "$2"
echo "$3"

:!: Note that the amc script has it's own --def exec option which is distinct from -exec and although it can do the same thing, does work in a different way:

Code: Select all

--def exec="/path/to/script.sh {quote f, historic.f, json}"



3.
:idea: You can configure FileBot to write xattr metadata into a plain file structure instead:
https://www.filebot.net/help/xattr.html
Thanks for the info. Got a couple follow up questions. I noticed that f for example is a File type object and several examples use certain properties of f (for example f.structurePathTail). Where would I find documentation on what properties a File type object contains? If this isn't documented, any chance you can point me to the source file that defines the File object type? At first I thought it might be a Groovy or Java File object, but that doesn't contain a structurePathTail property.

Thanks,
Harry
User avatar
rednoah
The Source
Posts: 20487
Joined: 16 Nov 2011, 08:59

Re: List of All Possible Parameters for AMC Script's exec Option?

Post by rednoah »

:idea: File.getStructurePathTail is a FileBot-specific extension method.


Here's a step-by-step example:
viewtopic.php?t=10824
:idea: Please read the FAQ and How to Request Help.
Post Reply