Help me simplify this please

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
machine123
Posts: 3
Joined: 03 Oct 2017, 04:18

Help me simplify this please

Post by machine123 »

Hi,
I want my movies to end up in different folders based on some of the keywords found in the title. So far I have got this

Code: Select all

--def movieFormat=$moviePath"/{fn =~ /3D/ ? '3D' : null}{fn =~ /2160p|.UHD./ ? '4k-uhd' : null}{fn =~ /REMUX|remux|Remux/ ? 'Remux' : null}{fn =~ /webdl|web-dl|WEB-DL|WEBDL/ ? 'WEB-DL' : null}//{n.replaceFirst(/^(?i)(The|A|An)\s(.+)/, /\$2, \$1/)} ({y})/{fn}" \
This seems to be working, however for 3D and UHD there usually is Remux in the title as well, so movies end up going to

'3DRemux' instead of '3D' and
'4k-uhdRemux' instead of '4k-uhd'

because it seems to evaluate all the conditions, wondering if there is a way to break if one of the conditions is satisifed? Also am I writing this "if this then that" condition the wrong way?

Appreciate the help. Thanks
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help me simplify this please

Post by rednoah »

Sure:

Code: Select all

{
	if (fn =~ /2160p/)
		'4K-UHD'
	else if (fn =~ /WEB/)
		'WEB-DL'
	else if (fn =~ /Remux/)
		'REMUX'
	else
		'NO-TAG'
}
:idea: Use the @file syntax for reading command-line arguments from external text files.
:idea: Please read the FAQ and How to Request Help.
machine123
Posts: 3
Joined: 03 Oct 2017, 04:18

Re: Help me simplify this please

Post by machine123 »

thank you so much
Post Reply