Hi!
I have just installed FileBot for the first time. I usually rename the multi audio movies as [Eng 5.1 - Hin 5.1 - Fre 2.0] where 5.1 and 2.0 are audio channels.
I could only find {languages} which formats like [eng, hin, fre] and {channels}.
However in the https://www.filebot.net/naming.html I could not find ways to capitalize the first letter of the languages
and to add the audio channel inside the brackets [] and also to replace comma (,) with a hyphen (-).
Please guide me considering as a newbie.
How to use pre-defined functions in {languages}
Re: How to use pre-defined functions in {languages}


e.g. Here's what you want:
Code: Select all
{
[audio.collect{[
it.LanguageString3.capitalize(),
it.ChannelPositionsString2.tokenize('/').take(2).join('.')
]}*.join(' ').join(' - ')]
}
Code: Select all
[Eng 2.0 - Jpn 2.0]

Re: How to use pre-defined functions in {languages}
This will fail and give output like this:
viewtopic.php?f=5&t=5285
so try this:[Eng 3.2 - Eng 3.2 - Fra 3.2 - Ita 3.2 - Spa 3.2 - Dut 3.2]
Code: Select all
{
def codecList =
[
'MP3' : 'MP3',
'PCM' : 'PCM',
'AAC LC' : 'AAC',
'AAC LC SBR' : 'AAC',
'AC 3' : 'AC3',
'AC 3 Dep' : 'EAC3',
'E AC 3' : 'EAC3',
'E AC 3 JOC' : 'EAC3 Atmos',
'DTS' : 'DTS',
'DTS 96 24' : 'DTS 96-24',
'DTS ES' : 'DTS-ES',
'DTS ES XXCH' : 'DTS-ES',
'DTS XBR' : 'DTS-HD HRA',
'DTS ES XBR' : 'DTS-HD HRA',
'DTS ES XXCH XBR' : 'DTS-HD HRA',
'DTS XLL' : 'DTS-HD MA',
'DTS ES XLL' : 'DTS-HD MA',
'DTS ES XXCH XLL' : 'DTS-HD MA',
'DTS XLL X' : 'DTS X',
'MLP FBA' : 'TrueHD',
'MLP FBA 16 ch' : 'TrueHD Atmos'
]
def filter = { [it.lang, it.ch] }
def audioStreams = []
def audioClean = { it.replaceAll(/[\p{Pd}\p{Space}]/, ' ').replaceAll(/\p{Space}{2,}/, ' ').slash(' ') }
def channelClean = { it.replaceAll(/Debug.+|Object\sBased\s?\/?|(\d+)?\sobjects\s\/\s|0.(?=\d.\d)|20/).replaceAll(/6.0/,'5.1').replaceAll(/8.0/,'7.1')}
def oneStream = { it.collect{ filter(it) }*.minus(null).unique().flatten().join(' ') }
def dString = { it.toDouble().toString() }
def toInt = { it.toInteger() }
audio.collect{ au ->
def codec = audioClean(any{ au['CodecID/Hint'] }{ au['Format'] })
def format_profile = any{ audioClean(au['Format_AdditionalFeatures'])}{}
def String ch = any{ channelClean(au.ChannelPositionsString2).tokenize('\\/')*.toDouble().toString().sum() }
{ channelClean(dString(au.ChannelsOriginal)) } { channelClean(dString(au.Channels)) }
def chFilter = (( ( (ac == 'AAC'||ac == 'MP3') && ch != '2.0') || ( (ac == 'AC3'||ac == 'EAC3'||ac == 'DTS'||ac == 'TrueHD'||ac == 'MLPFBA') && ch != '5.1' ) ) ? ch : null)
def combined = allOf{codec}{format_profile}.join(' ')
audioStreams << ['index' : codecList.findIndexOf {it.key == combined}, 'default' : au['default'][0].toBoolean(),
'codec' : codecList.get(combined, 'UNKNOWN_FORMAT'), 'combined' : combined, 'ch' : ch,
'bitrate' : any{toInt(au.BitRate)}{toInt(au.BitRate_Maximum)}{au.FrameRate.toDouble()}{null},
'objects' : any{'[' + au['NumberOfDynamicObjects'] + ' Objs]'}{null}, 'lang' : any{au.'LanguageString3'.upperInitial()}{null} ]
return audioStreams
}
def allStreams = audioStreams.collect{ filter(it) }*.minus(null).unique()*.join(' ')
allStreams.join(' - ')
}
Re: How to use pre-defined functions in {languages}
Presumably, this is what the OP is asking for, capitalized 3-letter language code plus channel positions, for each audio stream, separated by dash, enclosed in brackets:
Code: Select all
[Eng 5.1 - Hin 5.1 - Fre 2.0]
Code: Select all
[Eng 2.0 - Jpn 2.0]
Code: Select all
[Eng 3.2 - Eng 3.2 - Fra 3.2 - Ita 3.2 - Spa 3.2 - Dut 3.2]
Re: How to use pre-defined functions in {languages}
The only thing you may want to change is:
to
so only use brackets if 2+ audio streams
Code: Select all
allStreams.join(' - ')
Code: Select all
allStreams.size() > 1 ? '[' + allStreams.join(' - ') + ']' : allStreams.join(' - ')