Page 1 of 1

Why doesn't this Audio script work anymore?

Posted: 27 Aug 2021, 01:40
by cyberdoggy
It was working fine and one day I opened up Filebot and it no longer functioned?

Code: Select all

{"$ac "+af.replace('8ch', 'DD+7.1CH').replace('7ch', '6.1CH').replace('6ch', 'DD.5.1CH').replace('3ch', '2.1CH').replace('2ch','2.0CH')+""}.join('.').space('.')}

Re: Why doesn't this Audio script work anymore?

Posted: 27 Aug 2021, 02:37
by rednoah
af now returns a ChannelCount type object, instead of a String type object. You will need to call af.toString() first if you want to use String.replace() to replace text:

Code: Select all

{
	af.toString().replace('2ch', '2CH')
}

However, for readability you might prefer to treat af as an Integer type:

Code: Select all

{
	af == 8 ? 'DD+7.1CH' 
	: af == 7 ? '6.1CH'
	: af == 6 ? 'DD.5.1CH'
	: af == 3 ? '2.1CH'
	: af == 2 ? '2.0CH'
	: (af as int) + 'CH'
}



EDIT:

FileBot r8753 adds ChannelCount.format(Map) to simplify this type of use case.

Re: Why doesn't this Audio script work anymore?

Posted: 27 Aug 2021, 18:23
by kim
this is BAD code
8 ch is not = DD+ (aka EAC3)
6 ch is not ? DD (aka AC3)

e.g. 'DTS-HD MA 5.1' becomes DD = FAIL!

maybe look here:
viewtopic.php?f=5&t=5285

btw:

Code: Select all

{af} = 6ch
{af.value} = 6.0

Re: Why doesn't this Audio script work anymore?

Posted: 28 Aug 2021, 01:08
by cyberdoggy
Thanks, everybody, It's Working Again!