todo bien
This commit is contained in:
parent
f815a32a06
commit
689a638ccc
|
@ -26,98 +26,6 @@ def rutaKO = root+"error/"
|
||||||
/** Audio (definición) **/
|
/** Audio (definición) **/
|
||||||
def hayEAC3=false
|
def hayEAC3=false
|
||||||
|
|
||||||
def getAudiosFromListByFormat (format, listAudios) {
|
|
||||||
def result=[]
|
|
||||||
for (singleAudio in listAudios) {
|
|
||||||
if (singleAudio.Format==format) {
|
|
||||||
result.add(singleAudio)
|
|
||||||
if ("EAC3"==format) hayEAC3=true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
def getBestChannelFromList (audiosFormatFound) {
|
|
||||||
def bestChanel
|
|
||||||
def currentValue=0
|
|
||||||
for (myAudio2 in audiosFormatFound) {
|
|
||||||
if (myAudio2.Channels>currentValue) {
|
|
||||||
currentValue = myAudio2.Channels
|
|
||||||
bestChanel = myAudio2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bestChanel
|
|
||||||
}
|
|
||||||
def getMaxQuality (listOfLanguageAudio) {
|
|
||||||
def formatSet = ["PCM", "MLP FBA" ,"DTS", "FLAC", "AC-3", "E-AC-3", "EAC3", "AAC", "MPEG Audio", "MP3"]
|
|
||||||
for (cFormat in formatSet) {
|
|
||||||
def audiosFormatFound = getAudiosFromListByFormat(cFormat, listOfLanguageAudio);
|
|
||||||
if (!audiosFormatFound.isEmpty()) {
|
|
||||||
return getBestChannelFromList(audiosFormatFound)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//no debería llegar aquí, si lo hace hay que documentar el problema indicando el/los formato/s no encontrado/s
|
|
||||||
def formatosInvolucradosProblema='[formato_audio_no_encontrado-'
|
|
||||||
for (audioFormatNotFound in listOfLanguageAudio) {
|
|
||||||
formatosInvolucradosProblema = formatosInvolucradosProblema+' '+audioFormatNotFound.Format
|
|
||||||
}
|
|
||||||
formatosInvolucradosProblema=formatosInvolucradosProblema+']'
|
|
||||||
throw new Exception(formatosInvolucradosProblema)
|
|
||||||
}
|
|
||||||
|
|
||||||
def bloqueAudio
|
|
||||||
def printAudio (audio2Print) {
|
|
||||||
def idioma
|
|
||||||
def idiomaOrigin = audio2Print.Language_String
|
|
||||||
if (idiomaOrigin==null) {
|
|
||||||
idiomaOrigin = audio2Print.Title
|
|
||||||
if (idiomaOrigin =~ /(?i)\bcat\b/)
|
|
||||||
idioma = "Cat"
|
|
||||||
else if (idiomaOrigin =~ /(?i)\bcast\b|\bspa\b/)
|
|
||||||
idioma = "Es"
|
|
||||||
} else {
|
|
||||||
idioma = idiomaOrigin.replace("Catalan","Cat").replace("Espanol / Espanol", "Es").replaceFirst(/(?i)(spanish|espa.ol)/,"Es").replace("(ES)","")
|
|
||||||
}
|
|
||||||
def formato_audio = audio2Print.Format_Commercial.replace("Dolby Digital":"Dolby").replace(" Plus","+")
|
|
||||||
.replace("DTS-HD Master Audio","DTS-MA").replace("DTS-HD High Resolution Audio","DTS-HD-H")
|
|
||||||
.replace("MPEG Audio","MPEG").replace("HE-AAC","AAC+")
|
|
||||||
.replace(" with Dolby Atmos", "Atmos")
|
|
||||||
def canales = audio2Print.Channels.replace(2:'2.0', 6:'5.1', 8:'7.1')
|
|
||||||
return idioma + ' ' + formato_audio + ' ' + canales
|
|
||||||
}
|
|
||||||
def bloqueSubs
|
|
||||||
def handleSub(sub, capturedSubs) {
|
|
||||||
def lang = sub.Language_String != null ? sub.Language_String : sub.title
|
|
||||||
def lang3 = sub.Language_String3 != null ? sub.Language_String3 : sub.title
|
|
||||||
def forced = sub.title!=null ? sub.title.toLowerCase().contains("forzado") : false
|
|
||||||
if (!capturedSubs.containsKey(lang)) {
|
|
||||||
capturedSubs[lang] = lang3+(forced?'+F':'')
|
|
||||||
} else {
|
|
||||||
def existing=capturedSubs[lang]
|
|
||||||
if (!existing.contains('+F') && !existing.contains('+'))
|
|
||||||
capturedSubs[lang] = lang3+(forced?'+F':'+')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********/
|
|
||||||
/* otras funciones */
|
|
||||||
def getInicial () {
|
|
||||||
def nomIngles = localize.English.n
|
|
||||||
if (nomIngles.startsWith("The ") || nomIngles.startsWith("A "))
|
|
||||||
nomIngles = nomIngles.replaceFirst("The ",'').replaceFirst("A ",'')
|
|
||||||
def ini0 = nomIngles[0].toUpperCase()
|
|
||||||
def iniClear = nomIngles.size()>1 ? ini0.replaceAll(/[¡¿'#*\(]/,nomIngles[1].toUpperCase()) : ini0
|
|
||||||
def inicial = iniClear.replaceAll(/[0-9]/,'#')+'/'
|
|
||||||
return inicial
|
|
||||||
}
|
|
||||||
def normalLang(langs) {
|
|
||||||
return !langs.isEmpty() ? {try { for (lan in languages) langs.add(lan.toString()) } catch(err) {langs}}() : langs
|
|
||||||
}
|
|
||||||
def sanityCheck(newId) {
|
|
||||||
def oldId = fn.find(/\{tmdb-\d+\}/)?.find(/\d+/)
|
|
||||||
return oldId!=null ? oldId == newId.toString() : true
|
|
||||||
}
|
|
||||||
/***********/
|
|
||||||
|
|
||||||
try { //empieza el script
|
try { //empieza el script
|
||||||
|
|
||||||
/** Tipo de archivo incorrecto **/
|
/** Tipo de archivo incorrecto **/
|
||||||
|
@ -127,6 +35,13 @@ try { //empieza el script
|
||||||
else if (ext!="mkv" && ext!="avi" && ext!="mp4") {
|
else if (ext!="mkv" && ext!="avi" && ext!="mp4") {
|
||||||
throw new Exception("[formato_fichero_noestarndar]")
|
throw new Exception("[formato_fichero_noestarndar]")
|
||||||
}
|
}
|
||||||
|
//*** Relocate Remux and UHD to Transcode input folder
|
||||||
|
def peso = bytes.toString().before(' ').toDouble()
|
||||||
|
def numericBps = (mbps.toString().before(' ').toDouble()*1000000).round()
|
||||||
|
def es1080 = vf ==~ '1080.'
|
||||||
|
def es1080Remux = peso > 15 && numericBps >= 18000000
|
||||||
|
if (!relocation && (vf ==~ '2160.' || (es1080 && es1080Remux))) return root+"/to Transcode/"+fn
|
||||||
|
|
||||||
/* otras validaciones */
|
/* otras validaciones */
|
||||||
if (relocation && !sanityCheck(tmdbid)) return '@@@@@@ Names Sanity Check KO @@@@@@@ --> New name: '+localize.Spanish.n+' with tmdb='+tmdbid
|
if (relocation && !sanityCheck(tmdbid)) return '@@@@@@ Names Sanity Check KO @@@@@@@ --> New name: '+localize.Spanish.n+' with tmdb='+tmdbid
|
||||||
try {
|
try {
|
||||||
|
@ -147,30 +62,27 @@ try { //empieza el script
|
||||||
/**************/
|
/**************/
|
||||||
|
|
||||||
/******* Calidad ******/
|
/******* Calidad ******/
|
||||||
def peso = bytes.toString().before(' ').toDouble()
|
|
||||||
def numericBps = (mbps.toString().before(' ').toDouble()*1000000).round()
|
|
||||||
def calidad =
|
def calidad =
|
||||||
(vf == '2160p') ? //4K
|
(vf =~ '2160.') ? //4K
|
||||||
(peso > 30 && numericBps >= 26000000)
|
(peso > 30 && numericBps >= 26000000)
|
||||||
? "UHDRemux"
|
? "UHDRemux"
|
||||||
: (peso > 15)
|
: (peso > 15)
|
||||||
? "UHDRip"
|
? "UHDRip"
|
||||||
: "microUHD"
|
: "microUHD"
|
||||||
: (vf == '1080p') ? //1080
|
: es1080 ? //1080
|
||||||
(peso > 15 && numericBps >= 18000000)
|
es1080Remux
|
||||||
? "1080-BDRemux"
|
? vf+" BDRemux"
|
||||||
: (numericBps > 8000000)
|
: (numericBps > 8000000)
|
||||||
? "1080"
|
? vf
|
||||||
: "microHD"
|
: "microHD"
|
||||||
: vf
|
: vf
|
||||||
|
def fuente = {try{ source } catch(err){null}}()
|
||||||
|
if (fuente!=null) calidad = calidad.startsWith("micro") ? calidad : vf
|
||||||
/***************************/
|
/***************************/
|
||||||
|
|
||||||
|
|
||||||
/** Formato distribución **/
|
/** Formato distribución **/
|
||||||
formato_distribucion =
|
formato_distribucion = fuente!=null ? fuente : relocation ? '' :
|
||||||
fn=~/(?i)\bblu.?ray\b|\bbdrip\b/ ? (calidad==~"rip" ? '' : 'BDRip') :
|
fn=~/(?i)\bblu.?ray\b|\bbdrip\b/ ? (calidad=~/(?i).+rip/ ? '' : 'BDRip') :
|
||||||
fn=~/(?i)remux/ ? (calidad==~"remux" ? '' : 'BDRemux') :
|
fn=~/(?i)remux/ ? (calidad=~/(?i).+remux/ ? '' : 'BDRemux') :
|
||||||
fn=~/(?i)\bWEB.??(DL|RIP)\b/ ? 'WEB-DL' :
|
fn=~/(?i)\bWEB.??(DL|RIP)\b/ ? 'WEB-DL' :
|
||||||
''
|
''
|
||||||
if (formato_distribucion=='WEB-DL') {
|
if (formato_distribucion=='WEB-DL') {
|
||||||
|
@ -179,10 +91,8 @@ try { //empieza el script
|
||||||
if (plataforma!=null) plataforma = plataforma.replace("MVPLUS","MV+")
|
if (plataforma!=null) plataforma = plataforma.replace("MVPLUS","MV+")
|
||||||
formato_distribucion = formato_distribucion+(plataforma!=null?(' '+plataforma.toUpperCase()):'')
|
formato_distribucion = formato_distribucion+(plataforma!=null?(' '+plataforma.toUpperCase()):'')
|
||||||
} else if (hayEAC3) //por el audio también se determina que es web-dl
|
} else if (hayEAC3) //por el audio también se determina que es web-dl
|
||||||
formato_distribucion = 'WEB-DL'
|
formato_distribucion = '¿WEB-DL'
|
||||||
|
|
||||||
if (formato_distribucion!='') formato_distribucion=' '+formato_distribucion
|
if (formato_distribucion!='') formato_distribucion=' '+formato_distribucion
|
||||||
|
|
||||||
/**********************************/
|
/**********************************/
|
||||||
|
|
||||||
/**** HDR ********/
|
/**** HDR ********/
|
||||||
|
@ -206,6 +116,7 @@ try { //empieza el script
|
||||||
}
|
}
|
||||||
hdr_info = _HDRMap.find { k, v -> k =~ _HDR }?.value
|
hdr_info = _HDRMap.find { k, v -> k =~ _HDR }?.value
|
||||||
if (hdr_info!=null) hdr_info=' '+hdr_info
|
if (hdr_info!=null) hdr_info=' '+hdr_info
|
||||||
|
else hdr_info=''
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
/*****************/
|
/*****************/
|
||||||
|
|
||||||
|
@ -293,11 +204,12 @@ try { //empieza el script
|
||||||
|
|
||||||
|
|
||||||
/***** subtitulos *******/
|
/***** subtitulos *******/
|
||||||
|
def bloqueSubs
|
||||||
try {
|
try {
|
||||||
def capturedSubs = [:]
|
def capturedSubs = [:]
|
||||||
bloqueSubs = ' [sub '
|
bloqueSubs = ' [sub_ '
|
||||||
for (sub in text) handleSub(sub, capturedSubs)
|
for (sub in text) handleSub(sub, capturedSubs)
|
||||||
for (entry in capturedSubs) bloqueSubs += entry.value+', '
|
for (entry in capturedSubs) bloqueSubs += (entry.value!='null'?entry.value:'und')+', '
|
||||||
bloqueSubs = bloqueSubs.substring(0,bloqueSubs.size()-2)+']'
|
bloqueSubs = bloqueSubs.substring(0,bloqueSubs.size()-2)+']'
|
||||||
}catch(err){bloqueSubs=' [no sub]'}
|
}catch(err){bloqueSubs=' [no sub]'}
|
||||||
/************************/
|
/************************/
|
||||||
|
@ -416,7 +328,7 @@ try { //empieza el script
|
||||||
def extras = tracker != null ? ' ['+tracker.replace("HDOlimpo", "HDO")+']' : ''
|
def extras = tracker != null ? ' ['+tracker.replace("HDOlimpo", "HDO")+']' : ''
|
||||||
|
|
||||||
return ruta + inicial + carpetaPeli + nomPrincipal + extras + tmdb
|
return ruta + inicial + carpetaPeli + nomPrincipal + extras + tmdb
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
||||||
if (ubuntu_desktop) {
|
if (ubuntu_desktop) {
|
||||||
|
@ -456,3 +368,96 @@ try { //empieza el script
|
||||||
|
|
||||||
return resultado
|
return resultado
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************/
|
||||||
|
/********************************************************/
|
||||||
|
/************** FUNCIONES *******************************/
|
||||||
|
/********************************************************/
|
||||||
|
/********************************************************/
|
||||||
|
|
||||||
|
def getAudiosFromListByFormat (format, listAudios) {
|
||||||
|
def result=[]
|
||||||
|
for (singleAudio in listAudios) {
|
||||||
|
if (singleAudio.Format==format) {
|
||||||
|
result.add(singleAudio)
|
||||||
|
if ("EAC3"==format) hayEAC3=true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
def getBestChannelFromList (audiosFormatFound) {
|
||||||
|
def bestChanel
|
||||||
|
def currentValue=0
|
||||||
|
for (myAudio2 in audiosFormatFound) {
|
||||||
|
if (myAudio2.Channels>currentValue) {
|
||||||
|
currentValue = myAudio2.Channels
|
||||||
|
bestChanel = myAudio2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bestChanel
|
||||||
|
}
|
||||||
|
def getMaxQuality (listOfLanguageAudio) {
|
||||||
|
def formatSet = ["PCM", "MLP FBA" ,"DTS", "FLAC", "AC-3", "E-AC-3", "EAC3", "AAC", "MPEG Audio", "MP3"]
|
||||||
|
for (cFormat in formatSet) {
|
||||||
|
def audiosFormatFound = getAudiosFromListByFormat(cFormat, listOfLanguageAudio);
|
||||||
|
if (!audiosFormatFound.isEmpty()) {
|
||||||
|
return getBestChannelFromList(audiosFormatFound)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def bloqueAudio
|
||||||
|
def printAudio (audio2Print) {
|
||||||
|
def idioma
|
||||||
|
def idiomaOrigin = audio2Print.Language_String
|
||||||
|
if (idiomaOrigin==null) {
|
||||||
|
idiomaOrigin = audio2Print.Title
|
||||||
|
if (idiomaOrigin =~ /(?i)\bcat\b/)
|
||||||
|
idioma = "Cat"
|
||||||
|
else if (idiomaOrigin =~ /(?i)\bcast\b|\bspa\b/)
|
||||||
|
idioma = "Es"
|
||||||
|
} else {
|
||||||
|
idioma = idiomaOrigin.replace("Catalan","Cat").replace("Espanol / Espanol", "Es").replaceFirst(/(?i)(spanish|espa.ol)/,"Es").replace("(ES)","")
|
||||||
|
}
|
||||||
|
def formato_audio = audio2Print.Format_Commercial.replace("Dolby Digital":"Dolby").replace(" Plus","+")
|
||||||
|
.replace("DTS-HD Master Audio","DTS-MA").replace("DTS-HD High Resolution Audio","DTS-HD-H")
|
||||||
|
.replace("MPEG Audio","MPEG").replace("HE-AAC","AAC+")
|
||||||
|
.replace(" with Dolby Atmos", "Atmos")
|
||||||
|
def canales = audio2Print.Channels.replace(2:'2.0', 6:'5.1', 8:'7.1')
|
||||||
|
return idioma + ' ' + formato_audio + ' ' + canales
|
||||||
|
}
|
||||||
|
|
||||||
|
def handleSub(sub, capturedSubs) {
|
||||||
|
def lang = sub.Language_String != null ? sub.Language_String : sub.title
|
||||||
|
def lang3 = sub.Language_String3 != null ? sub.Language_String3 : sub.title
|
||||||
|
def forced = sub.title!=null ? sub.title.toLowerCase().contains("forzado") : false
|
||||||
|
if (!capturedSubs.containsKey(lang)) {
|
||||||
|
capturedSubs[lang] = lang3+(forced?'+F':'')
|
||||||
|
} else {
|
||||||
|
def existing=capturedSubs[lang]
|
||||||
|
if (!existing.contains('+F') && !existing.contains('+'))
|
||||||
|
capturedSubs[lang] = lang3+(forced?'+F':'+')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********/
|
||||||
|
/* otras funciones */
|
||||||
|
def getInicial () {
|
||||||
|
def nomIngles = localize.English.n
|
||||||
|
if (nomIngles.startsWith("The ") || nomIngles.startsWith("A "))
|
||||||
|
nomIngles = nomIngles.replaceFirst("The ",'').replaceFirst("A ",'')
|
||||||
|
def ini0 = nomIngles[0].toUpperCase()
|
||||||
|
def iniClear = nomIngles.size()>1 ? ini0.replaceAll(/[¡¿'#*\(]/,nomIngles[1].toUpperCase()) : ini0
|
||||||
|
def inicial = iniClear.replaceAll(/[0-9]/,'#')+'/'
|
||||||
|
return inicial
|
||||||
|
}
|
||||||
|
def normalLang(langs) {
|
||||||
|
return !langs.isEmpty() ? {try { for (lan in languages) langs.add(lan.toString()) } catch(err) {langs}}() : langs
|
||||||
|
}
|
||||||
|
def sanityCheck(newId) {
|
||||||
|
def oldId = fn.find(/\{tmdb-\d+\}/)?.find(/\d+/)
|
||||||
|
return oldId!=null ? oldId == newId.toString() : true
|
||||||
|
}
|
||||||
|
/***********/
|
||||||
|
|
|
@ -0,0 +1,187 @@
|
||||||
|
|
||||||
|
def getAudiosFromListByFormat (format, listAudios) {
|
||||||
|
def result=[]
|
||||||
|
for (singleAudio in listAudios) {
|
||||||
|
if (singleAudio.Format==format) {
|
||||||
|
result.add(singleAudio)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
def getBestChannelFromList (audiosFormatFound) {
|
||||||
|
def bestChanel
|
||||||
|
def currentValue=0
|
||||||
|
for (myAudio2 in audiosFormatFound) {
|
||||||
|
if (myAudio2.Channels>currentValue) {
|
||||||
|
currentValue = myAudio2.Channels
|
||||||
|
bestChanel = myAudio2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bestChanel
|
||||||
|
}
|
||||||
|
def getMaxQuality (listOfLanguageAudio) {
|
||||||
|
def formatSet = ["PCM", "MLP FBA" ,"DTS", "FLAC", "AC-3", "E-AC-3", "EAC3", "AAC", "MPEG Audio", "MP3"]
|
||||||
|
for (cFormat in formatSet) {
|
||||||
|
def audiosFormatFound = getAudiosFromListByFormat(cFormat, listOfLanguageAudio);
|
||||||
|
if (!audiosFormatFound.isEmpty()) {
|
||||||
|
return getBestChannelFromList(audiosFormatFound)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//no debería llegar aquí, si lo hace hay que documentar el problema indicando el/los formato/s no encontrado/s
|
||||||
|
def formatosInvolucradosProblema='[formato_audio_no_encontrado-'
|
||||||
|
for (audioFormatNotFound in listOfLanguageAudio) {
|
||||||
|
formatosInvolucradosProblema = formatosInvolucradosProblema+' '+audioFormatNotFound.Format
|
||||||
|
}
|
||||||
|
formatosInvolucradosProblema=formatosInvolucradosProblema+']'
|
||||||
|
throw new Exception(formatosInvolucradosProblema)
|
||||||
|
}
|
||||||
|
|
||||||
|
def bloqueAudio
|
||||||
|
def printAudio (audio2Print) {
|
||||||
|
def idioma
|
||||||
|
def idiomaOrigin = audio2Print.Language_String
|
||||||
|
if (idiomaOrigin==null) {
|
||||||
|
idiomaOrigin = audio2Print.Title
|
||||||
|
if (idiomaOrigin =~ /(?i)\bcat\b/)
|
||||||
|
idioma = "Cat"
|
||||||
|
else if (idiomaOrigin =~ /(?i)\bcast\b|\bspa\b/)
|
||||||
|
idioma = "Es"
|
||||||
|
} else {
|
||||||
|
idioma = idiomaOrigin.replace("Catalan","Cat").replace("Espanol / Espanol", "Es").replaceFirst(/(?i)(spanish|espa.ol)/,"Es").replace("(ES)","")
|
||||||
|
}
|
||||||
|
def formato_audio = audio2Print.Format_Commercial.replace("Dolby Digital":"Dolby").replace(" Plus","+")
|
||||||
|
.replace("DTS-HD Master Audio","DTS-MA").replace("DTS-HD High Resolution Audio","DTS-HD-H")
|
||||||
|
.replace("MPEG Audio","MPEG").replace("HE-AAC","AAC+")
|
||||||
|
.replace(" with Dolby Atmos", "Atmos")
|
||||||
|
def canales = audio2Print.Channels.replace(2:'2.0', 6:'5.1', 8:'7.1')
|
||||||
|
return idioma + ' ' + formato_audio + ' ' + canales
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Audio (ejecución) **/
|
||||||
|
def catalanAudios=[]
|
||||||
|
def spanishAudios=[]
|
||||||
|
def englishAudios=[]
|
||||||
|
def otherAudios=[]
|
||||||
|
def audioDeclUndefined=false
|
||||||
|
for (item in audio) {
|
||||||
|
def idioma
|
||||||
|
try {
|
||||||
|
idioma = item.Language_String
|
||||||
|
if (idioma==null) otherAudios.add("audio_no_def") //throw new Exception("[idioma_audio_no_definido0]")
|
||||||
|
if ("Catalan"==idioma) catalanAudios.add(item)
|
||||||
|
else if (idioma=~/(?i)(Spanish|Espa.ol)/) spanishAudios.add(item)
|
||||||
|
else if ("English"==idioma) englishAudios.add(item)
|
||||||
|
else if ("Undefined"==idioma) audioDeclUndefined=true
|
||||||
|
else otherAudios.add(item)
|
||||||
|
} catch (err) {
|
||||||
|
if (idioma==null) {
|
||||||
|
try { //si tampoco tiene item.Title
|
||||||
|
def audioTitle=item.Title
|
||||||
|
if (audioTitle!=null) {
|
||||||
|
if (any{audioTitle}{0} =~ /(?i)\bcat\b/)
|
||||||
|
catalanAudios.add(item)
|
||||||
|
else if (any{audioTitle}{0} =~ /(?i)\bcast\b|\bspa\b/)
|
||||||
|
spanishAudios.add(item)
|
||||||
|
else if (any{audioTitle}{0} =~ /(?i)\bingl.es\b|\beng\b/)
|
||||||
|
englishAudios.add(item)
|
||||||
|
else otherAudios.add(item)
|
||||||
|
}
|
||||||
|
} catch (ex) {}
|
||||||
|
} else if (!skipAudioCheck) throw err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (audioDeclUndefined || (catalanAudios.isEmpty() && spanishAudios.isEmpty() && englishAudios.isEmpty() && otherAudios.isEmpty()) ) {
|
||||||
|
if (!skipAudioCheck) throw new Exception("[idioma_audio_no_definido]")
|
||||||
|
}
|
||||||
|
def tenimCat=false
|
||||||
|
if (!catalanAudios.isEmpty()) { //tenim català
|
||||||
|
tenimCat=true
|
||||||
|
def maxCat = getMaxQuality(catalanAudios)
|
||||||
|
def blocCat = printAudio(maxCat)
|
||||||
|
def tenimEsp = !spanishAudios.isEmpty()
|
||||||
|
def blocEsp=''
|
||||||
|
if (tenimEsp) {
|
||||||
|
def maxEsp = getMaxQuality(spanishAudios)
|
||||||
|
blocEsp = ', '+printAudio(maxEsp)
|
||||||
|
}
|
||||||
|
bloqueAudio = blocCat + blocEsp
|
||||||
|
} else if (!spanishAudios.isEmpty()) { //tenemos español
|
||||||
|
def maxEsp = getMaxQuality(spanishAudios)
|
||||||
|
bloqueAudio = printAudio(maxEsp)
|
||||||
|
} else if (!englishAudios.isEmpty()) { //tenemos español
|
||||||
|
if (!skipAudioCheck) throw new Exception("[idioma_audio_solo_ingles]")
|
||||||
|
} else if (!otherAudios.isEmpty()) { //tenemos español
|
||||||
|
if (!skipAudioCheck) throw new Exception("[idioma_audio_marginal]")
|
||||||
|
} else {
|
||||||
|
if (!skipAudioCheck) throw new Exception("[idioma_audio_no_encontrado]")
|
||||||
|
}
|
||||||
|
if (bloqueAudio==null) bloqueAudio = "[audio_no_def]"
|
||||||
|
else bloqueAudio = ' ['+bloqueAudio+']'
|
||||||
|
/***********/
|
||||||
|
/*********************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
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]
|
||||||
|
}
|
||||||
|
|
||||||
|
for (audioElms in audiosMap) {
|
||||||
|
def k = audioElms.key
|
||||||
|
def v = audioElms.value
|
||||||
|
def s = v.size()
|
||||||
|
def mQ = getMaxQuality2(v)
|
||||||
|
if (s>1) k = k+'('+s+')'
|
||||||
|
bloqueAudio2 += k+' '+printAudio2(mQ)+', '
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********/
|
||||||
|
def getMaxQuality2 (listOfLanguageAudio) {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def printAudio2 (audio2Print) {
|
||||||
|
def formato_audio = audio2Print.Format_Commercial.replace("Dolby Digital":"Dolby").replace(" Plus","+")
|
||||||
|
.replace("DTS-HD Master Audio","DTS-MA").replace("DTS-HD High Resolution Audio","DTS-HD-H")
|
||||||
|
.replace("MPEG Audio","MPEG").replace("HE-AAC","AAC+")
|
||||||
|
.replace(" with Dolby Atmos", "Atmos").replace("TrueHD", "HD")
|
||||||
|
def canales = audio2Print.Channels.replace(2:'2.0', 6:'5.1', 8:'7.1')
|
||||||
|
return formato_audio + ' ' + canales
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def getAudiosFromListByFormat2 (format, listAudios) {
|
||||||
|
def result=[]
|
||||||
|
for (singleAudio in listAudios) {
|
||||||
|
if (singleAudio.Format==format) {
|
||||||
|
result.add(singleAudio)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
def getBestChannelFromList2 (audiosFormatFound) {
|
||||||
|
def bestChanel
|
||||||
|
def currentValue=0
|
||||||
|
for (myAudio2 in audiosFormatFound) {
|
||||||
|
if (myAudio2.Channels>currentValue) {
|
||||||
|
currentValue = myAudio2.Channels
|
||||||
|
bestChanel = myAudio2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bestChanel
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return bloqueAudio + ' vs [' + bloqueAudio2.substring(0,bloqueAudio2.size()-2) + ']'
|
Loading…
Reference in New Issue