Page 1 of 1

[FEATURE] AMC script test action

Posted: 29 Jan 2018, 21:23
by devster
I might be missing a step, but the way I'm currently launching the command whenever I execute the AMC script with --action test the exec command is still executed, which leads to a bunch of errors since the file doesn't actually exist.

Code: Select all

/usr/local/bin/filebot -script fn:amc --action test --output /out --conflict skip -non-strict --log-file amc.log --def artwork=y --def ut_dir=/dir ut_kind=multi ut_title=title ut_label=N/A --def 'exec=/path/to/post-script.sh {quote file} {quote f.dir.dir} {info.database} {info.id} {quote info.name}' --def [email protected] --def [email protected] --def [email protected]
Is it possible to add this check in the script and skip the execution of the command?

Re: [FEATURE] AMC script test action

Posted: 30 Jan 2018, 11:10
by rednoah
No, but you can do that check in your post-script.sh script:
https://stackoverflow.com/questions/638 ... st-in-bash

Re: [FEATURE] AMC script test action

Posted: 30 Jan 2018, 14:29
by devster
So would a change such as the following to amc.groovy:

Code: Select all

if ('TEST'.equalsIgnoreCase(_args.action)) {
	exec = false
} else {
	exec = tryQuietly{ exec.toString() }
}
be a bad idea?

Re: [FEATURE] AMC script test action

Posted: 30 Jan 2018, 17:13
by rednoah
Yes, because you'd make testing of --def exec expressions impossible. Note that --def exec can be used for absolutely any kind of command-line call, which may be just printing extra information via echo, writing extra logs about processed files somewhere, making web requests to some API via curl, etc.

Re: [FEATURE] AMC script test action

Posted: 30 Jan 2018, 19:14
by devster
Ok, now I see the issue, thank you.