Page 1 of 1

configure the script to add the best audio available

Posted: 19 Dec 2023, 19:49
by Vittatus
hello! I have this script that works perfect except for a couple of things.
1. Some audios are not named completely, that is, DTS-HD MA only marks them as DTS, trueHD gives me some strange characters.
2. I would like that if the file has several audios, for example "English AC3 and English DTS-HD MA" I would only be given the highest quality one.
Is there a possibility to do it?

Thank you.


Format: Select all

{n} ({y}) [BDRip {vf}][{ import java.math.RoundingMode
  import net.filebot.Language
  audio.collect { au ->
    def channels = any{ au['ChannelPositions/String2'] }{ au['Channel(s)_Original'] }{ au['Channel(s)'] }
    def ch = channels.tokenize('\\/')*.toDouble()
                  .inject(0, { a, b -> a + b }).findAll { it > 0 }
                  .max().toBigDecimal().setScale(1, RoundingMode.HALF_UP).toString()
   def codec = any{ au['CodecID/Hint'] }{ au['Format'] }.replaceAll(/['`´‘’?\p{Punct}\p{Space}]/, '')
   return allOf{Language.findLanguage(au['Language']).ISO3.upper()}{codec}{ch} }*.join("  ").join(" - ") }]

Re: configure the script to add the best audio available

Posted: 19 Dec 2023, 19:58
by rednoah
:?: Is this your format or did you copy & paste it from somewhere? (anything is possible, but limited to what you can express in code)


:?: How do you define "highest quality one" exactly and precisely for all possible audio stream properties? (expressing this in code will likely be your primary coding challenge)


:?: What does the MediaInfo Inspector say for the file at hand?

Screenshot