186 lines
6.6 KiB
Groovy
Executable File
186 lines
6.6 KiB
Groovy
Executable File
/*************************************************************************************************************/
|
|
/**** Carpeta / tipo contenido ******************************************************************************/
|
|
/*************************************************************************************************************/
|
|
|
|
//inits
|
|
def tipoYaSeteado=false
|
|
def prodCountries= {try{info.ProductionCountries} catch(e){[]}}()
|
|
def certifications={try{info.Certifications} catch(e){[]}}()
|
|
def pais = {try{country} catch (err) {null}}()
|
|
if (pais==null) pais = {try{info.country} catch (err) {null}}()
|
|
def numPaises = prodCountries.size()
|
|
def llengu = {try {def langs=[]; for (lan in languages) langs.add(lan.toString()); return langs } catch(err) {[]}}()
|
|
def audioLlengu = {try {def langs=[]; for (lan in audioLanguages) langs.add(lan.toString()); return langs } catch(err) {[]}}()
|
|
def llenguaOriginal = {try{info.OriginalLanguage} catch(e){null}}()
|
|
|
|
//animacion (no concluyente)
|
|
def fakeAnimacionList = ["blue & malone", "cool world"]
|
|
def tieneAnimacion = genres.any{ it =~ /Anima.i.n/} && !fakeAnimacionList.any{localize.English.n.toLowerCase().contains(it)}
|
|
//familiar (no conclud)
|
|
def tieneFamiliar = genres.any{ it =~ /Familia|Family/}
|
|
//docu
|
|
def esDocu = genres.any{ it =~ /Documental|Documentary|Reality/} && !(localize.English.n =~ /Jackass/)
|
|
//Anime ---------- (Animacion encara no es pot perquè depen del infantil)
|
|
def esAnime = false
|
|
if (tieneAnimacion && llenguaOriginal=='ja') {
|
|
esAnime = (numPaises==1 || anime || pais=="JP")
|
|
&& ["nemo"].any{!localize.English.n.toLowerCase().contains(it)}
|
|
}
|
|
//musica
|
|
def esMusica = genres.size()==1 && genres.any{ it =~ /Música|Music/}
|
|
|
|
tipoYaSeteado = esDocu || esAnime
|
|
|
|
//***** familiar vs infantil ****
|
|
def esFamiliar = tieneFamiliar
|
|
def infantil = false
|
|
|
|
if (!tipoYaSeteado) {
|
|
def tieneCertificacion = certifications!=null && certifications.size()!=0
|
|
def detectadoNoInfantil = tieneCertificacion && (
|
|
(certifications.US!=null && certifications.US==~/PG-13|R/)
|
|
|| (certifications.ES!=null && certifications.ES==~/16|18/))
|
|
|
|
if (detectadoNoInfantil) infantil=false
|
|
else if (tieneFamiliar && tieneAnimacion) infantil=true
|
|
else if (tieneAnimacion) {
|
|
if (tieneCertificacion) {
|
|
infantil = (certifications.US!=null ? certifications.US!="R" : true) &&
|
|
(certifications.US=="G"
|
|
|| certifications.ES==~/Ai|APTA/
|
|
|| certifications.DE==~/0/
|
|
|| certifications.IT=="T"
|
|
|| certifications.IE=="G"
|
|
|| certifications.LT=="V" || certifications.RU ==~ /6.+/
|
|
|| certifications.BR=="L"
|
|
|| certifications.NO=="A"
|
|
|| certifications.FR=="U")
|
|
} else {
|
|
def titulosInfantiles = ['boonie bears', 'the jungle bunch']
|
|
if (titulosInfantiles.any { localize.English.n.toLowerCase().contains(it) })
|
|
infantil = true
|
|
}
|
|
} else if (!esFamiliar && false) { //em posa pelicules que no toquen
|
|
if (tieneCertificacion && (
|
|
certifications.US=="G"
|
|
)) {
|
|
esFamiliar = true //posem a familiar pelis de nens que no son animacio
|
|
}
|
|
}
|
|
tipoYaSeteado = tipoYaSeteado || infantil
|
|
}
|
|
|
|
//animacion
|
|
def esAnimacion = tieneAnimacion && !infantil && !["brexitazo","dibujos maléficos"].any{localize.Spanish.n.toLowerCase().contains(it)}
|
|
|
|
//catalana
|
|
def catalana = llenguaOriginal=~/cat?/ //|| (llengu.contains('cat') && llengu.size()<4)
|
|
|
|
//hispana
|
|
def espanyola = llenguaOriginal=='gl' || llenguaOriginal=='eu'
|
|
|
|
/** español <castellano / latino> **/
|
|
def latina = ["che: el argentino"].any{localize.Spanish.n.toLowerCase().contains(it)}
|
|
def notSure = false
|
|
tipoYaSeteado == tipoYaSeteado || esAnimacion || catalana || espanyola || latina
|
|
if (!tipoYaSeteado && llenguaOriginal=~/es|spa/) {
|
|
// latina ***
|
|
def latinWhitelist = {try{info.ProductionCompanies.any{it=~/Corazón Films/}} catch(e){false} }()
|
|
|| {try{["Kenya Marquez"].any{director==it}}catch(err){false}}()
|
|
|
|
if (latinWhitelist) {
|
|
latina = true
|
|
} else if (["nightmare radio"].any{ localize.Spanish.n.toLowerCase().contains(it) }
|
|
|| numPaises == 0 /*en seguiment*/
|
|
|| {try{ info.Network =~ /(?i)\bFLIXOL.\b|\b.?TVE\b|\bAntena 3\b/ }catch(e){ false } }()
|
|
|| {try{ info.ProductionCompanies.any{it =~ /.?TVE|ESDIP|Canal Sur|Canal\+|Telecinco/} }catch(e){false}}()
|
|
) {
|
|
//latina = false (redundant)
|
|
if (numPaises == 0) notSure = true
|
|
} else {
|
|
def paisesLatinos = ["MX", "AR", "CO", "BR", "CL", "PE", "CU", "VE", "UY"]
|
|
def numPaisesLat = paisesLatinos.intersect(prodCountries).size()
|
|
latina = numPaisesLat>0
|
|
//double check fake latin
|
|
if (latina) {
|
|
def isActuallySpanish =
|
|
(certifications.size()==1 && certifications.ES!=null)
|
|
|| {try{ movie.alternativeTitles.size()==1 && movie.alternativeTitles.containsKey("ES") }catch(e){false}}()
|
|
if (isActuallySpanish) latina = false
|
|
}
|
|
}
|
|
if (!latina) espanyola = true
|
|
tipoYaSeteado = tipoYaSeteado || espanyola || latina
|
|
}
|
|
|
|
//asiaticas
|
|
def asiatica = false
|
|
if (!tipoYaSeteado) {
|
|
def languajAsia = isMovie ? ["zh", "cn", "ko", "th", "vi", "ja", "id", "tl", "bo", "te"]
|
|
: ["zho", "cn", "kor", "tha", "vie", "jpn", "ind", "tgl", "bod"]
|
|
asiatica = languajAsia.contains(llenguaOriginal)
|
|
tipoYaSeteado = tipoYaSeteado || asiatica
|
|
}
|
|
|
|
def muslim = false
|
|
//mohameds
|
|
if (!tipoYaSeteado) {
|
|
def languajMohamed = ["ar", "tr", "ur"]
|
|
muslim = languajMohamed.contains(llenguaOriginal)
|
|
tipoYaSeteado = tipoYaSeteado || muslim
|
|
}
|
|
|
|
def eslavo = false
|
|
//mohameds
|
|
if (!tipoYaSeteado) {
|
|
def languajEslavo = ["pl", "ru", "uk", "be", "cs", "sk", "sl", "hr", "bs", "mk", "sr", "bg", "me"]
|
|
eslavo = languajEslavo.contains(llenguaOriginal)
|
|
tipoYaSeteado = tipoYaSeteado || eslavo
|
|
}
|
|
//africa
|
|
def africa = false
|
|
if (!tipoYaSeteado) {
|
|
def paisAfrica = ["NG"]
|
|
africa = paisAfrica.contains(pais)
|
|
tipoYaSeteado = tipoYaSeteado || africa
|
|
}
|
|
//bollywood
|
|
def bollywood = false
|
|
if (!tipoYaSeteado) {
|
|
def languajBollywood = ["hi"]
|
|
bollywood = languajBollywood.contains(llenguaOriginal)
|
|
tipoYaSeteado = tipoYaSeteado || bollywood
|
|
}
|
|
//france
|
|
def france = false
|
|
if (!tipoYaSeteado) {
|
|
def languajFrance = ["fr"]
|
|
france = languajFrance.contains(llenguaOriginal)
|
|
tipoYaSeteado = tipoYaSeteado || france
|
|
}
|
|
//german
|
|
def german = false
|
|
if (!tipoYaSeteado) {
|
|
def languajGerman = ["de"]
|
|
german = languajGerman.contains(llenguaOriginal)
|
|
tipoYaSeteado = tipoYaSeteado || german
|
|
}
|
|
//italy
|
|
def italy = false
|
|
if (!tipoYaSeteado) {
|
|
def languajItaly = ["it"]
|
|
italy = languajItaly.contains(llenguaOriginal)
|
|
tipoYaSeteado = tipoYaSeteado || italy
|
|
}
|
|
//brasil
|
|
def brasil = false
|
|
if (!tipoYaSeteado) {
|
|
brasil = pais=="BR" || (numPaises==1 && prodCountries.contains("BR"))
|
|
tipoYaSeteado = tipoYaSeteado || brasil
|
|
}
|
|
//portugal
|
|
def portugal = false
|
|
if (!tipoYaSeteado) {
|
|
portugal = pais=="PT" || (numPaises==1 && prodCountries.contains("PT"))
|
|
tipoYaSeteado = tipoYaSeteado || portugal
|
|
} |