bona repassada
This commit is contained in:
parent
68997fc469
commit
9d60356ee5
|
@ -23,10 +23,6 @@ def rutaKO = root+"error/"
|
|||
def skipAudioCheck = true
|
||||
/*************/
|
||||
|
||||
/* Excepciones */
|
||||
|
||||
/***************/
|
||||
|
||||
/** Audio (definición) **/
|
||||
def hayEAC3=false
|
||||
|
||||
|
@ -90,48 +86,6 @@ def printAudio (audio2Print) {
|
|||
}
|
||||
/***********/
|
||||
/* otras funciones */
|
||||
def tieneGeneroAnimacion (generos) {
|
||||
for (genero in generos) {
|
||||
if (genero =~ /Anima[c|t]i\p{L}n/)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
def tieneGeneroFamilia (generos) {
|
||||
for (genero in generos) {
|
||||
if (genero =~ /Familia|Family/)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
def tieneGeneroDocumental (generos) {
|
||||
for (genero in generos) {
|
||||
if (genero =~ /Documental|Documentary/)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
def tieneGeneroReality (generos) {
|
||||
for (genero in generos) {
|
||||
if (genero =~ /Reality/)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
def esDocumental (generos, title) {
|
||||
def noJackass = !(title =~ /Jackass/)
|
||||
return (tieneGeneroDocumental(generos) || tieneGeneroReality(generos)) && noJackass
|
||||
}
|
||||
def fromEspPlatform () {
|
||||
def platformES = false
|
||||
try { platformES =
|
||||
info.Network =~ /(?i)\bFLIXOL.\b|\b.?TVE\b/ } catch (ex) {}
|
||||
def companyEs = false
|
||||
try { companyEs =
|
||||
info.ProductionCompanies =~ /.?TVE|ESDIP/ } catch (ex) {}
|
||||
return platformES || companyEs
|
||||
}
|
||||
/**/
|
||||
def getInicial () {
|
||||
def nomIngles = localize.English.n
|
||||
if (nomIngles.startsWith("The ") || nomIngles.startsWith("A "))
|
||||
|
@ -141,19 +95,13 @@ def getInicial () {
|
|||
def inicial = iniClear.replaceAll(/[0-9]/,'#')+'/'
|
||||
return inicial
|
||||
}
|
||||
|
||||
/***********/
|
||||
|
||||
try { //empieza el script
|
||||
|
||||
/** Tipo de archivo incorrecto **/
|
||||
def esFicheroMetadatos = false
|
||||
def tipoMetadato
|
||||
def nombreWbloqueMediainfo
|
||||
if (ext=="jpg" || ext=="nfo" || ext=="png") {
|
||||
esFicheroMetadatos = true
|
||||
tipoMetadato = fn.find( //coge el contenido que encaja
|
||||
/(?=\-[^-]+$)(.*)(?<!\}|\])$/ )
|
||||
if(tipoMetadato==null)tipoMetadato=''
|
||||
if (ext==~/jpg|nfo|png|url/) {
|
||||
return fn
|
||||
}
|
||||
else if (ext!="mkv" && ext!="avi" && ext!="mp4") {
|
||||
throw new Exception("[formato_fichero_noestarndar]")
|
||||
|
@ -163,6 +111,11 @@ try { //empieza el script
|
|||
} catch (e) {
|
||||
throw new Exception("[video_roto]")
|
||||
}
|
||||
try {
|
||||
genres
|
||||
} catch (err) {
|
||||
throw new Exception("[genero_no_especificado]")
|
||||
}
|
||||
/********************************/
|
||||
|
||||
/** Codec Vídeo: en nombre fichero **/
|
||||
|
@ -170,7 +123,7 @@ try { //empieza el script
|
|||
(any{vc}{0} =~ /264/) ? 'AVC' : vc
|
||||
/**************/
|
||||
|
||||
/******* Calidad: División en carpetas y definición nombre fichero ******/
|
||||
/******* Calidad ******/
|
||||
def peso = bytes.toString().before(' ').toDouble()
|
||||
def numericBps = (mbps.toString().before(' ').toDouble()*1000000).round()
|
||||
def calidad =
|
||||
|
@ -261,9 +214,6 @@ try { //empieza el script
|
|||
if (bloqueAudio==null) bloqueAudio = "audio_no_def"
|
||||
/***********/
|
||||
|
||||
//todo lo demás solo interesa para el fichero que contiene la pelicula
|
||||
//if (esFicheroMetadatos==false) {
|
||||
|
||||
/** Formato distribución **/
|
||||
formato_distribucion =
|
||||
fn=~/(?i)\bblu.?ray\b/ ? 'BDRip' :
|
||||
|
@ -319,23 +269,6 @@ try { //empieza el script
|
|||
if (formato_distribucion!='') formato_distribucion=' '+formato_distribucion
|
||||
/**********************************/
|
||||
|
||||
/**** Nombre pelicula ****/
|
||||
def nombrePelicula_formatoPlex
|
||||
def tieneQueUsarSpa=true
|
||||
if (tenimCat) {
|
||||
try {
|
||||
if (primaryTitle!=localize.Catalan.n) {
|
||||
tieneQueUsarSpa = false
|
||||
nombrePelicula_formatoPlex = localize.Catalan.plex.name
|
||||
}
|
||||
} catch (err) {
|
||||
tieneQueUsarSpa=true
|
||||
}
|
||||
}
|
||||
if (tieneQueUsarSpa)
|
||||
nombrePelicula_formatoPlex = localize.Spanish.plex.name
|
||||
/*************************/
|
||||
|
||||
/**** HDR ********/
|
||||
def hdr_info=''
|
||||
try{
|
||||
|
@ -388,56 +321,61 @@ try { //empieza el script
|
|||
def bloqueProfundidad = myBitrate+myFps
|
||||
if (bloqueProfundidad!='' && profundidadColor!='') bloqueProfundidad=' '+bloqueProfundidad
|
||||
|
||||
nombreWbloqueMediainfo = nombrePelicula_formatoPlex +' ['+codecVideo+' '+bloqueCalidadVideo+']['+profundidadColor+bloqueProfundidad+']'+' ['+bloqueAudio+']'
|
||||
//+' {imdb-'+imdbid+'}'
|
||||
//}
|
||||
def bloqueMediainfo = ' ['+codecVideo+' '+bloqueCalidadVideo+']['+profundidadColor+bloqueProfundidad+']'+' ['+bloqueAudio+']'
|
||||
|
||||
|
||||
|
||||
/**************************************/
|
||||
/**** Carpeta / tipo contenido *******/
|
||||
def generes
|
||||
def errorNoGenero=false
|
||||
try {generes=genres} catch (err) {errorNoGenero=true}
|
||||
def numPaises = info.ProductionCountries.size()
|
||||
def tipoYaSeteado=false
|
||||
|
||||
def tieneAnimacion = tieneGeneroAnimacion(generes)
|
||||
def tieneFamiliar = tieneGeneroFamilia(generes)
|
||||
|
||||
def esDocu = esDocumental(generes, localize.English.n)
|
||||
//animacion (no concluyente)
|
||||
def tieneAnimacion = genres.any{ it =~ /Anima.i.n/}
|
||||
//familiar (no conclud)
|
||||
def tieneFamiliar = genres.any{ it =~ /Familia|Family/}
|
||||
//docu
|
||||
def esDocu = genres.any{ it =~ /Documental|Documentary|Reality/} && !(title =~ /Jackass/)
|
||||
//anime
|
||||
def esAnime = false
|
||||
def numPaises = info.ProductionCountries.size()
|
||||
if (tieneAnimacion && info.ProductionCountries.contains("JP")) {
|
||||
esAnime = numPaises==1 || anime
|
||||
esAnime = numPaises==1 || anime /*|| country=="JP"*/
|
||||
}
|
||||
tipoYaSeteado = esDocu || esAnime
|
||||
|
||||
//*** española ***
|
||||
def hispanico = info.ProductionCountries.contains("ES") && (numPaises==1 || (numPaises==2 && info.ProductionCountries.contains("PT")))
|
||||
def espanyola = hispanico || fromEspPlatform() || (info.Certifications.size()==1 && info.Certifications.ES!=null)
|
||||
//|| ({ try { languages.size()==1 && languages.get(0)=="esp" } catch (Exception e) { null } })()
|
||||
|
||||
def espanyola = false
|
||||
if (!tipoYaSeteado && info.ProductionCountries.contains("ES")) {
|
||||
espanyola=
|
||||
(numPaises==1 || (numPaises==2 && info.ProductionCountries.contains("PT")))
|
||||
|| { try { info.Network =~ /(?i)\bFLIXOL.\b|\b.?TVE\b/ } catch (e) { false } }()
|
||||
|| { try { info.ProductionCompanies.any{ it =~ /.?TVE|ESDIP|Canal Sur|Canal\+ España/ } } catch (e) { false } }()
|
||||
|| (info.Certifications.size()==1 && info.Certifications.ES!=null)
|
||||
|| { try { languages.size()==1 && languages.get(0).toString()=~/esp|spa/ } catch (e) { false } }()
|
||||
|| (movie.alternativeTitles.size()==1 && movie.alternativeTitles.ES!=null)
|
||||
|| { try { country=="ES" } catch (e){false} }() && { try { if(languages.size()==1) languages.get(0).toString()!="eng" } catch (e) { false } }()
|
||||
tipoYaSeteado = espanyola
|
||||
}
|
||||
|
||||
//***** familiar vs infantil ****
|
||||
def esFamiliar = tieneFamiliar
|
||||
def infantil = false
|
||||
|
||||
def tipoYaSeteado=esDocu || esAnime
|
||||
if (!tipoYaSeteado) {
|
||||
|
||||
def tieneCertificacion = info.Certifications!=null && info.Certifications.size()!=0
|
||||
|
||||
if (tieneFamiliar && tieneAnimacion) {
|
||||
def noTanInfantil = info.Certifications.US ==~/PG-13/
|
||||
if (!noTanInfantil)
|
||||
infantil = true
|
||||
if (!noTanInfantil) infantil = true
|
||||
}
|
||||
else if (tieneAnimacion) {
|
||||
if (tieneCertificacion) {
|
||||
if ( info.Certifications.US=="G"
|
||||
infantil = info.Certifications.US=="G"
|
||||
|| info.Certifications.ES==~/Ai|APTA/
|
||||
|| info.Certifications.DE==~/0|6/
|
||||
|| info.Certifications.IT=="T"
|
||||
|| info.Certifications.LT=="V" || info.Certifications.RU ==~ /6.+/
|
||||
|| info.Certifications.BR=="L"
|
||||
)
|
||||
infantil=true
|
||||
} else {
|
||||
def titulosInfantiles = ['Bonnie bears', 'The Jungle Bunch']
|
||||
if (titulosInfantiles.any { localize.English.n.toLowerCase()contains(it.toLowerCase()) })
|
||||
|
@ -450,25 +388,26 @@ try { //empieza el script
|
|||
esFamiliar = true //posem a familiar pelis de nens que no son animacio
|
||||
}
|
||||
}
|
||||
tipoYaSeteado = esFamiliar || infantil
|
||||
}
|
||||
|
||||
//asiaticas
|
||||
def asiatica = false
|
||||
tipoYaSeteado = tipoYaSeteado & (infantil || espanyola)
|
||||
if (!tipoYaSeteado) {
|
||||
//asiaticas
|
||||
if (numPaises>0) {
|
||||
def paisesAsiaticos = ["CN", "HK", "JP", "KP", "KR", "TH", "NP", "TW", "PH", "MO"]
|
||||
def languajAsia = ["zho", "kor", "thai", "vie", "jpn", "ind"]
|
||||
def matchP = paisesAsiaticos.intersect(info.ProductionCountries)
|
||||
def allAsian = matchP.size()==numPaises
|
||||
def probableAsian = matchP.size()>0 && englishAudios.isEmpty() && audio.size()>1
|
||||
if (allAsian || probableAsian/*en obseracion*/) asiatica=true
|
||||
asiatica = matchP.size() == numPaises
|
||||
|| {try { languages.any{ languajAsia.contains(it.toString()) } } catch (err) {false} }()
|
||||
//|| matchP.size()>0 && englishAudios.isEmpty() && audio.size()>1 /*en obseracion*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//es animacion
|
||||
def esAnimacion = tieneAnimacion && !esFamiliar && !espanyola && !asiatica
|
||||
|
||||
def esAnimacion = tieneAnimacion && !esFamiliar
|
||||
|
||||
//tria
|
||||
if (esDocu) ruta = ruta_docu
|
||||
|
@ -484,33 +423,29 @@ try { //empieza el script
|
|||
/********************************************/
|
||||
/**************************************/
|
||||
|
||||
//if (errorNoGenero && ruta!=ruta_classic && ruta!=ruta_retro && !espanyola && !semiEsp && !infantil && ruta!=ruta_estrenos )
|
||||
// throw new Exception("[genero_no_especificado]")
|
||||
|
||||
/**** Nombre pelicula ****/
|
||||
def nombrePelicula_formatoPlex = {try { primaryTitle!=localize.Catalan.n ? localize.Catalan.plex.name : localize.Spanish.plex.name } catch (err) {localize.Spanish.plex.name} }()
|
||||
/*************************/
|
||||
|
||||
|
||||
/*** RESULTADO FINAL ***/
|
||||
def inicial=''
|
||||
|
||||
def inicialsRequerides = ruta==rutaOK || ruta==ruta_retro
|
||||
if (inicialsRequerides) {
|
||||
inicial = getInicial()
|
||||
}
|
||||
def inicial = (ruta==rutaOK || ruta==ruta_retro) ? getInicial() : ''
|
||||
def tmdb = " {tmdb-"+tmdbid+"}"
|
||||
def nomPrincipal = esFicheroMetadatos ? nombreWbloqueMediainfo+tipoMetadato : nombreWbloqueMediainfo
|
||||
def carpetaPeli = localize.Spanish.plex.name + tmdb + '/'
|
||||
def nomPrincipal = nombrePelicula_formatoPlex + bloqueMediainfo
|
||||
def tracker = fn.find(/(?i)\bHDO(limpo)?\b/)
|
||||
def extras = tracker != null ? ' ['+tracker.replace("HDOlimpo", "HDO")+']' : ''
|
||||
def resultado = ruta + //directorios
|
||||
//nombre fichero
|
||||
inicial +
|
||||
localize.English.plex.name + '/' + nomPrincipal + extras + tmdb
|
||||
//(esFicheroMetadatos ? localize.Spanish.plex.name+tipoMetadato : nombreWbloqueMediainfo)
|
||||
|
||||
return resultado
|
||||
return ruta + inicial + carpetaPeli + nomPrincipal + extras + tmdb
|
||||
|
||||
} catch (err) {
|
||||
|
||||
if (ubuntu_desktop) {
|
||||
String str= err.getStackTrace().toString()
|
||||
def pattern = ( str =~ /groovy.(\d+)./ )
|
||||
return " Error at line number = " + pattern[0][1] + ". more: "+str
|
||||
}
|
||||
|
||||
def rutaMotivoErr
|
||||
def msgErr = err.getMessage()
|
||||
|
|
|
@ -21,44 +21,8 @@ def rutaKO = root+"error/"
|
|||
|
||||
/* HARDCODED */
|
||||
def skipAudioCheck = true
|
||||
def infantilHardCoded = false
|
||||
|
||||
/* otras funciones */
|
||||
def tieneGeneroAnimacion (generos) {
|
||||
for (genero in generos) {
|
||||
if (genero =~ /Anima[c|t]i\p{L}n/)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
def tieneGeneroFamilia (generos) {
|
||||
for (genero in generos) {
|
||||
if (genero =~ /Familia|Family/)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
def tieneGeneroDocumental (generos) {
|
||||
for (genero in generos) {
|
||||
if (genero =~ /Documental|Documentary/)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
def tieneGeneroReality (generos) {
|
||||
for (genero in generos) {
|
||||
if (genero =~ /Reality/)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
def esDocumental (generos, title) {
|
||||
def noJackass = !(title =~ /Jackass/)
|
||||
return (tieneGeneroDocumental(generos) || tieneGeneroReality(generos)) && noJackass
|
||||
}
|
||||
def fromEspPlatform () {
|
||||
return fn.find(/(?i)\bFLIXOL.\b|\bRTVE\b/) != null
|
||||
}
|
||||
/**/
|
||||
def getInicial () {
|
||||
def nomIngles = localize.English.n
|
||||
|
@ -91,6 +55,11 @@ try { //empieza el script
|
|||
} catch (e) {
|
||||
throw new Exception("[video_roto]")
|
||||
}
|
||||
try {
|
||||
genres
|
||||
} catch (err) {
|
||||
throw new Exception("[genero_no_especificado]")
|
||||
}
|
||||
/********************************/
|
||||
|
||||
|
||||
|
@ -150,24 +119,35 @@ try { //empieza el script
|
|||
|
||||
/**************************************/
|
||||
/**** Carpeta / tipo contenido *******/
|
||||
def generes
|
||||
def errorNoGenero=false
|
||||
try {generes=genres} catch (err) {errorNoGenero=true}
|
||||
def tipoYaSeteado=false
|
||||
|
||||
def tieneAnimacion = tieneGeneroAnimacion(generes)
|
||||
def tieneFamiliar = tieneGeneroFamilia(generes)
|
||||
|
||||
def esDocu = esDocumental(generes, localize.English.n)
|
||||
//animacion (no concluyente)
|
||||
def tieneAnimacion = genres.any{ it =~ /Anima.i.n/}
|
||||
//familiar (no conclud)
|
||||
def tieneFamiliar = genres.any{ it =~ /Familia|Family/}
|
||||
//docu
|
||||
def esDocu = genres.any{ it =~ /Documental|Documentary|Reality/} && !localize.English.n.contains("Jackass")
|
||||
//anime
|
||||
def esAnime = false
|
||||
def numPaises = info.ProductionCountries.size()
|
||||
if (tieneAnimacion && info.ProductionCountries.contains("JP")) {
|
||||
esAnime = info.ProductionCountries.size()==1 || anime
|
||||
esAnime = numPaises==1 || anime /*|| country=="JP"*/
|
||||
}
|
||||
tipoYaSeteado = esDocu || esAnime
|
||||
|
||||
//*** española ***
|
||||
def espanyola = tipoYaSeteado
|
||||
|| info.ProductionCountries.contains("ES") && (numPaises==1 || (numPaises==2 && info.ProductionCountries.contains("PT")))
|
||||
|| { try { info.Network =~ /(?i)\bFLIXOL.\b|\b.?TVE\b/ } catch (e) { false } }()
|
||||
|| { try { info.ProductionCompanies.any{ it =~ /.?TVE|ESDIP|Canal Sur|Canal\+ España/ } } catch (e) { false } }()
|
||||
|| (info.Certifications.size()==1 && info.Certifications.ES!=null)
|
||||
|| { try { languages.size()==1 && languages.get(0).toString()=="esp" } catch (e) { false } }() || (movie.alternativeTitles.size()==1 && movie.alternativeTitles.ES!=null)
|
||||
|| { try { country=="ES" } catch (e){false} }() && { try { if(languages.size()==1) languages.get(0).toString()!="eng" } catch (e) { false } }()
|
||||
tipoYaSeteado = tipoYaSeteado || espanyola
|
||||
|
||||
//***** familiar vs infantil ****
|
||||
def esFamiliar = tieneFamiliar
|
||||
def infantil = false
|
||||
|
||||
def tipoYaSeteado=esDocu || esAnime
|
||||
if (!tipoYaSeteado) {
|
||||
|
||||
def tieneCertificacion = info.Certifications!=null && info.Certifications.size()!=0
|
||||
|
@ -199,44 +179,39 @@ try { //empieza el script
|
|||
esFamiliar = true //posem a familiar pelis de nens que no son animacio
|
||||
}
|
||||
}
|
||||
tipoYaSeteado = tipoYaSeteado || infantil
|
||||
}
|
||||
|
||||
//espanyoles & asiaticas
|
||||
def espanyola = false
|
||||
def asiatica = false
|
||||
tipoYaSeteado=esDocu || esAnime || esFamiliar || infantil
|
||||
if (!tipoYaSeteado) {
|
||||
|
||||
def segurEsp = info.ProductionCountries.contains("ES") && info.ProductionCountries.size()==1
|
||||
espanyola = fromEspPlatform() || segurEsp
|
||||
|
||||
//asiaticas
|
||||
if (!espanyola && info.ProductionCountries.size()>0) {
|
||||
def asiatica = false
|
||||
if (!tipoYaSeteado) {
|
||||
//asiaticas
|
||||
if (numPaises>0) {
|
||||
def paisesAsiaticos = ["CN", "HK", "JP", "KP", "KR", "TH", "NP", "TW", "PH", "MO"]
|
||||
def matchP = paisesAsiaticos.intersect(info.ProductionCountries)
|
||||
def allAsian = matchP.size()==info.ProductionCountries.size()
|
||||
def allAsian = matchP.size()==numPaises
|
||||
def probableAsian = matchP.size()>0 && englishAudios.isEmpty() && audio.size()>1
|
||||
if (allAsian || probableAsian/*en obseracion*/) asiatica=true
|
||||
}
|
||||
}
|
||||
|
||||
//es animacion
|
||||
def esAnimacion = tieneAnimacion && !esFamiliar
|
||||
|
||||
//tria
|
||||
if (esDocu) ruta = ruta_docu
|
||||
else if (esAnime) ruta = ruta_anime
|
||||
else if (infantil) ruta = ruta_infantil
|
||||
else if (esFamiliar) ruta = ruta_familiar
|
||||
else if (tieneAnimacion) ruta = ruta_animacion
|
||||
else if (asiatica) ruta = ruta_asiaticas
|
||||
else if (esAnimacion) ruta = ruta_animacion
|
||||
else if (espanyola) ruta = ruta_esp
|
||||
else if (esFamiliar) ruta = ruta_familiar
|
||||
else if (asiatica) ruta = ruta_asiaticas
|
||||
else if (y<1980) ruta = ruta_classic
|
||||
else if (y<2000) ruta = ruta_retro
|
||||
if (ruta==rutaOK && y>=2021) ruta = ruta_estrenos
|
||||
/********************************************/
|
||||
/**************************************/
|
||||
|
||||
//if (errorNoGenero && ruta!=ruta_classic && ruta!=ruta_retro && !espanyola && !semiEsp && !infantil && ruta!=ruta_esp_retro && ruta!=ruta_esp_classic && ruta!=ruta_estrenos )
|
||||
// throw new Exception("[genero_no_especificado]")
|
||||
|
||||
/*** RESULTADO FINAL ***/
|
||||
def inicial=''
|
||||
|
||||
|
|
Loading…
Reference in New Issue