I use this code to extract the Audio Track Name from the video file. I prefer to use the track name because sometime he have more version of the same language like english and english British. The code work but when the file do not contain any Audio Track Name, the code put the bracket [] on the name even if I used the -null.
How can I remove the []?
Example With Audio Track: 1917 (2019) - MULTi[VFQ,VFF, ENG,GER] 2160p 10bit 4K Light HDR10 x265 AC3 5.1.mkv
Example Without Audio Track: 1917 (2019) - [] 2160p 10bit 4K Light HDR10 x265 AC3 5.1.mkv
Code: Select all
{audio.collect{ au -> any{au.title}{''} } - null}
Full Code that I used for the examples :
Code: Select all
{
norm = {
it
.upperInitial()
.lowerTrail()
.replaceTrailingBrackets()
.replaceAll(/[`´‘’ʻ""“”]/, "'")
.replaceAll(/[:*?"<>|?]/)
.replaceAll(':', ':')
.replaceAll(/[?]/, "?")
}
;norm(n)
}
({y}) -
{if (norm(n) != norm(primaryTitle)) ' ('+norm(primaryTitle)+')'}
{
if (audioLanguages.size() == 2)
return "MULTi"
if (audioLanguages.size() > 2)
return "MULTi"
}
{audio.collect{ au -> any{au.title}{''} } - null}
{' '}
{vf}
{' '}
{' '}
{ bitdepth == 10 ? ' 10bit' : null }
{' '}
{
if (hd == 'SD')
if (bytes.MB >= 700 && bitrate.mbps >= 1.1)
return 'DVDRip'
else
return 'TVRip'
if (hd == 'HD')
if (bytes.MB >= 100 && bitrate.mbps >= 18)
return 'BDRemux'
else if (bitrate.mbps >= 8)
return 'BDRip'
else if (bitrate.mbps >= 2.2)
return 'HDLight'
else if (vf == '1080p')
return 'BRRip'
else
return 'HDRip'
if (hd == 'UHD')
if (bytes.MB >= 100 && bitrate.mbps >= 32)
return '4K Remux'
else if (bitrate.mbps >= 16)
return '4K'
else if (bitrate.mbps >= 3)
return '4K Light'
else
return '4K BRRip'
}
{' '}{hdr}
{' '}{ video[0].CodecID =~ /HEVC/ ? 'x265' : 'H.264'}
{' '}{ac}
{' '}{channels}