Page 1 of 1

Filebot code with "must contain"

Posted: 16 Apr 2020, 08:04
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 ??

Re: Filebot code with "must contain"

Posted: 16 Apr 2020, 09:58
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()
}

Re: Filebot code with "must contain"

Posted: 16 Apr 2020, 11:36
by shadoc
thank you ;)