Page 1 of 1

Help me simplify this please

Posted: 06 Oct 2017, 17:37
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

Re: Help me simplify this please

Posted: 06 Oct 2017, 17:47
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.

Re: Help me simplify this please

Posted: 06 Oct 2017, 17:57
by machine123
thank you so much

Re: Help me simplify this please

Posted: 13 Jul 2022, 22:38
by rednoah