Page 1 of 1

Adding a value for a null binding

Posted: 29 Mar 2023, 17:43
by cheaters
Here is my pseudo code.
I am failing at what I want to accomplish. I tried poking around the forums but couldn't assimilate much.
I want FileBot to add [SDR] when a file has no value for hdr. and of course I want to expand on this with more cases.

Code: Select all

{
	if (hdr==/Dolby Vision/)
		{hdr.replace('Dolby Vision','[DV]')}
	else
		'[SDR]'
}

Code: Select all

{
	if (hdr==/Dolby Vision/)
		{hdr.replace('Dolby Vision','[DV]')}
	else
		{hdr.replace(null,'[SDR]')}
}
tried adding '' instead of null... nope

Re: Adding a value for a null binding

Posted: 30 Mar 2023, 03:13
by rednoah

Re: Adding a value for a null binding

Posted: 30 Mar 2023, 15:54
by cheaters
Thank you for the link!
It took me another 40 minutes of failing (with those examples in hand :? ) to come up with this working construct:

Code: Select all

{"${self.hdr ?: '[SDR]'}"}

Code: Select all

{"${self.hdr ? '[HDR]' : '[SDR]'}"}
AND while those work I am still unable to get a working IF THEN ELSE statement.

I want to incorporate .replace to Replace "Dolby Vision" with "DV"

As I say, we have to know 50% of the answer in order to effectively search for the solution... and in this case I knew about 10%

Re: Adding a value for a null binding

Posted: 30 Mar 2023, 17:48
by rednoah
e.g.

Code: Select all

[{ any{ hdr.replace('Dolby Vision':'DV') }{ 'SDR' } }]