Adding a value for a null binding

Support for macOS users
Post Reply
cheaters
Posts: 214
Joined: 09 Oct 2016, 02:01

Adding a value for a null binding

Post 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
cheaters
Posts: 214
Joined: 09 Oct 2016, 02:01

Re: Adding a value for a null binding

Post 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%
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Adding a value for a null binding

Post by rednoah »

e.g.

Code: Select all

[{ any{ hdr.replace('Dolby Vision':'DV') }{ 'SDR' } }]
:idea: Please read the FAQ and How to Request Help.
Post Reply