configure the script to add the best audio available

Any questions? Need some help?
Post Reply
Vittatus
Posts: 4
Joined: 12 May 2019, 09:01

configure the script to add the best audio available

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

Re: configure the script to add the best audio available

Post 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
:idea: Please read the FAQ and How to Request Help.
Post Reply