1
0
Fork 0

bona jugada

This commit is contained in:
Xavier Fontanet 2023-05-11 19:11:48 +02:00
parent 944b89702e
commit e447c2a4e4
1 changed files with 28 additions and 8 deletions

View File

@ -122,13 +122,28 @@ def printAudio (audio2Print) {
/***********/
/*********************************************************/
def bloqueAudio2=''
def audiosMap = [:]
for (aud in audio) {
def shortDesc = aud.Language_String3
if (audiosMap.containsKey(shortDesc)) audiosMap[shortDesc].add(aud)
else audiosMap[shortDesc] = [aud]
audiosMap[shortDesc] = audiosMap[shortDesc] ?: [:]
audiosMap[shortDesc][aud.Format] = audiosMap[shortDesc][aud.Format] ?: []
audiosMap[shortDesc][aud.Format] << aud
}
def groupedAudiosMap = [:]
for (audioElms in audiosMap) {
def k = audioElms.key
@ -139,6 +154,7 @@ for (audioElms in audiosMap) {
if (groupedAudiosMap.containsKey(mQstr)) groupedAudiosMap[mQstr].add(k)
else groupedAudiosMap[mQstr] = [k]
}
audiosMap=null
def temp=''
for (audioGroup in groupedAudiosMap) {
@ -163,13 +179,12 @@ bloqueAudio2 = removeLastComa(bloqueAudio2)
def removeLastComa(txt) {
return txt.substring(0, txt.size()-2)
}
def getMaxQuality2 (listOfLanguageAudio) {
def formatSet = ["PCM", "MLP FBA" ,"DTS", "FLAC", "AC-3", "E-AC-3", "EAC3", "AAC", "MPEG Audio", "MP3"]
def getMaxQuality2 (mapAudioIndexedByFormat) {
def formatSet = ["PCM", "MLP FBA" ,"DTS", "FLAC", "AC-3", "E-AC-3", "EAC3", "AAC", "MPEG Audio", "MP3"]
for (cFormat in formatSet) {
def audiosFormatFound = getAudiosFromListByFormat2(cFormat, listOfLanguageAudio);
if (!audiosFormatFound.isEmpty()) {
return getBestChannelFromList2(audiosFormatFound)
}
if (mapAudioIndexedByFormat.containsKey(cFormat)){
return getBestChannelFromList2(mapAudioIndexedByFormat[cFormat])
}
}
}
@ -205,4 +220,9 @@ def getBestChannelFromList2 (audiosFormatFound) {
}
/************************/
return bloqueAudio + ' vs [' + bloqueAudio2 + ']'