Why doesn't this Audio script work anymore?

All about user-defined episode / movie / file name format expressions
Post Reply
cyberdoggy
Posts: 34
Joined: 03 Sep 2016, 21:27

Why doesn't this Audio script work anymore?

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

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

Post 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.
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

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

Post 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
cyberdoggy
Posts: 34
Joined: 03 Sep 2016, 21:27

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

Post by cyberdoggy »

Thanks, everybody, It's Working Again!
Post Reply