Filebot code with "must contain"

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
shadoc
Posts: 6
Joined: 19 Mar 2020, 17:16

Filebot code with "must contain"

Post by shadoc »

Hi all ;)

Please look at my code:

Code: Select all

filebot -script fn:amc --output "/Volumes/HDD_4/Torrents/Hardlink/Test" --action hardlink -non-strict "/Volumes/HDD_4/Torrents/1" --log-file amc.log --def excludeList=amc.txt --def unsorted=y music=y artwork=n "ut_label=" "ut_kind=multi" movieFormat="{genres.contains('Animation') ? 'Animations' : info.productionCompanies.contains('Marvel Studios') ? 'Marvel' : info.productionCompanies.contains('Lucasfilm') ? 'Star Wars' : info.productionCompanies.contains('Documentaire') ? 'Documentaire' : info.productionCompanies.contains('DC Comics') ? 'DC Comics' : info.productionCompanies.contains('Marvel Entertainement') ? 'Marvel' : 'Films'} /{plex.name}" --lang fr
I would like to integrate the function must contain and not contains:

Code: Select all

info.productionCompanies(fn =~ 'Marvel') ? 'Marvel'
But it doesn't work: / I can't find the right code, or is my error please ??
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot code with "must contain"

Post by rednoah »

You can use =~ to do a simple if-then-else:

Code: Select all

{info.productionCompanies =~ /Marvel/ ? 'Marvel' : null}

If you have lots of checks, then this approach will be more scalable:

Code: Select all

{
	info.productionCompanies*.match(
		/Marvel/ : 'Marvel',
		/Lucasfilm/ : 'Star Wars',
	).find()
}
:idea: Please read the FAQ and How to Request Help.
shadoc
Posts: 6
Joined: 19 Mar 2020, 17:16

Re: Filebot code with "must contain"

Post by shadoc »

thank you ;)
Post Reply