hard refactor completed
This commit is contained in:
parent
093a7252c8
commit
ad567c9785
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
def only_relocate=true
|
||||||
|
@split/init_relocate.groovy
|
||||||
|
@split/root_folders.groovy
|
||||||
|
@split/folder_file.groovy
|
||||||
|
@split/catch.groovy
|
||||||
|
@split/functions.groovy
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
def relocationFrom="Pelis/"
|
||||||
|
@split/init_relocate.groovy
|
||||||
|
@split/root_folders.groovy
|
||||||
|
@split/validations.groovy
|
||||||
|
@split/video.groovy
|
||||||
|
@split/audio.groovy
|
||||||
|
@split/subs.groovy
|
||||||
|
@split/folder_file.groovy
|
||||||
|
@split/catch.groovy
|
||||||
|
@split/functions.groovy
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
@split/init_newMovies.groovy
|
||||||
|
@split/root_folders.groovy
|
||||||
|
@split/validations.groovy
|
||||||
|
@split/video.groovy
|
||||||
|
@split/audio.groovy
|
||||||
|
@split/subs.groovy
|
||||||
|
@split/folder_file.groovy
|
||||||
|
@split/catch.groovy
|
||||||
|
@split/functions.groovy
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
def llengu = {try {def langs=[]; for (lan in languages) langs.add(lan.toString()); return langs } catch(err) {[]}}()
|
||||||
|
return info.ProductionCountries.contains("ES") && llengu.contains('cat')
|
|
@ -1,16 +1,22 @@
|
||||||
//by @xeviff
|
//by @xeviff
|
||||||
/** RUTAS **/
|
/* HARDCODED */
|
||||||
def ubuntu_desktop=false
|
def skipAudioCheck = true
|
||||||
|
def show_error_line=true
|
||||||
|
def ubuntu_desktop=true
|
||||||
|
|
||||||
def root = ubuntu_desktop ? '/mnt/mangrana_pelis/' : '/pelis/'
|
|
||||||
|
/** RUTAS **/
|
||||||
|
def root = '/pelis/'
|
||||||
def rutaOK = root+"Pelis/plain/"
|
def rutaOK = root+"Pelis/plain/"
|
||||||
def ruta = rutaOK
|
def ruta = rutaOK
|
||||||
def ruta_docu = root+"Documentales/plain/"
|
def ruta_docu = root+"Documentales/plain/"
|
||||||
def ruta_anime = root+"Pelis_anime/plain/"
|
def ruta_anime = root+"Pelis_anime/"
|
||||||
def ruta_animacion = root+"Pelis_animacion/"
|
def ruta_animacion = root+"Pelis_animacion/"
|
||||||
def ruta_infantil = root+"Pelis_infantiles/"
|
def ruta_infantil = root+"Pelis_infantiles/"
|
||||||
def ruta_familiar = root+"Pelis_familiar/"
|
def ruta_familiar = root+"Pelis_familiar/"
|
||||||
def ruta_esp = root+"Pelis_esp/plain/"
|
def ruta_esp = root+"Pelis_esp/plain/"
|
||||||
|
def ruta_latina = root+"Pelis_lat/"
|
||||||
|
def ruta_cat = root+"Pelis_cat/"
|
||||||
def ruta_retro = root+"Pelis_retro/plain/"
|
def ruta_retro = root+"Pelis_retro/plain/"
|
||||||
def ruta_estrenos = root+"Pelis_estrenos/plain/"
|
def ruta_estrenos = root+"Pelis_estrenos/plain/"
|
||||||
def ruta_classic = root+"Pelis_classic/"
|
def ruta_classic = root+"Pelis_classic/"
|
||||||
|
@ -19,28 +25,7 @@ def ruta_asiaticas = root+"Pelis_asiaticas/"
|
||||||
def rutaKO = root+"error/"
|
def rutaKO = root+"error/"
|
||||||
/**********/
|
/**********/
|
||||||
|
|
||||||
/* HARDCODED */
|
|
||||||
def skipAudioCheck = true
|
|
||||||
def show_error_line=true
|
|
||||||
|
|
||||||
/* 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+/)
|
|
||||||
oldId!=null ? oldId == newId.toString() : true
|
|
||||||
}
|
|
||||||
//*****************************************************************************************/
|
//*****************************************************************************************/
|
||||||
//*****************************************************************************************/
|
//*****************************************************************************************/
|
||||||
//*****************************************************************************************/
|
//*****************************************************************************************/
|
||||||
|
@ -55,52 +40,35 @@ 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]")
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
video
|
|
||||||
} catch (e) {
|
|
||||||
throw new Exception("[video_roto]")
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
genres
|
|
||||||
} catch (err) {
|
|
||||||
throw new Exception("[genero_no_especificado]")
|
|
||||||
}
|
|
||||||
/********************************/
|
/********************************/
|
||||||
|
|
||||||
|
|
||||||
/**************************************/
|
/*************************************************************************************************************/
|
||||||
/**** Carpeta / tipo contenido *******/
|
/**** Carpeta / tipo contenido ******************************************************************************/
|
||||||
|
/*************************************************************************************************************/
|
||||||
|
|
||||||
|
//inits
|
||||||
def tipoYaSeteado=false
|
def tipoYaSeteado=false
|
||||||
def llengu=[]
|
def prodCountries=info.ProductionCountries
|
||||||
|
def certifications=info.Certifications
|
||||||
|
def numPaises = info.ProductionCountries.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) {[]}}()
|
||||||
|
|
||||||
//animacion (no concluyente)
|
//animacion (no concluyente)
|
||||||
def tieneAnimacion = genres.any{ it =~ /Anima.i.n/}
|
def tieneAnimacion = genres.any{ it =~ /Anima.i.n/}
|
||||||
//familiar (no conclud)
|
//familiar (no conclud)
|
||||||
def tieneFamiliar = genres.any{ it =~ /Familia|Family/}
|
def tieneFamiliar = genres.any{ it =~ /Familia|Family/}
|
||||||
//docu
|
//docu
|
||||||
def esDocu = genres.any{ it =~ /Documental|Documentary|Reality/} && !localize.English.n.contains("Jackass")
|
def esDocu = genres.any{ it =~ /Documental|Documentary|Reality/} && !(localize.English.n =~ /Jackass/)
|
||||||
//anime
|
//Anime ---------- (Animacion encara no es pot perquè depen del infantil)
|
||||||
def esAnime = false
|
def esAnime = false
|
||||||
def numPaises = info.ProductionCountries.size()
|
if (tieneAnimacion && info.ProductionCountries.contains("JP") && (!llengu.isEmpty() ? llengu.contains('jpn') : true)) {
|
||||||
if (tieneAnimacion && info.ProductionCountries.contains("JP")) {
|
esAnime = (numPaises==1 || anime || country=="JP")
|
||||||
esAnime = numPaises==1 || anime /*|| country=="JP"*/
|
&& ["nemo"].any{!localize.English.n.toLowerCase().contains(it)}
|
||||||
}
|
}
|
||||||
tipoYaSeteado = esDocu || esAnime
|
tipoYaSeteado = esDocu || esAnime
|
||||||
|
|
||||||
//*** española ***
|
|
||||||
def espanyola = false
|
|
||||||
if (!tipoYaSeteado && info.ProductionCountries.contains("ES")) {
|
|
||||||
espanyola=
|
|
||||||
(numPaises==1 || (numPaises==2 && info.ProductionCountries.any{ it=~/AR|PT/ }))
|
|
||||||
|| { try { info.Network =~ /(?i)\bFLIXOL.\b|\b.?TVE\b/ } catch (e) { false } }()
|
|
||||||
|| { try { info.ProductionCompanies.any{ it =~ /.?TVE|ESDIP|Canal Sur|Canal\+|Telecinco/ } } catch (e) { false } }()
|
|
||||||
|| (info.Certifications.size()==1 && info.Certifications.ES!=null)
|
|
||||||
|| { llengu=normalLang(llengu); llengu.size()==1 && llengu[0]=~/esp|spa/}()
|
|
||||||
|| (movie.alternativeTitles.size()==1 && movie.alternativeTitles.ES!=null)
|
|
||||||
|| (country=="ES" && (!llengu.isEmpty() ? llengu.size()==1 && llengu[0]!="eng" : true))
|
|
||||||
tipoYaSeteado = espanyola
|
|
||||||
}
|
|
||||||
|
|
||||||
//***** familiar vs infantil ****
|
//***** familiar vs infantil ****
|
||||||
def esFamiliar = tieneFamiliar
|
def esFamiliar = tieneFamiliar
|
||||||
def infantil = false
|
def infantil = false
|
||||||
|
@ -109,20 +77,23 @@ try { //empieza el script
|
||||||
def tieneCertificacion = info.Certifications!=null && info.Certifications.size()!=0
|
def tieneCertificacion = info.Certifications!=null && info.Certifications.size()!=0
|
||||||
|
|
||||||
if (tieneFamiliar && tieneAnimacion) {
|
if (tieneFamiliar && tieneAnimacion) {
|
||||||
def noTanInfantil = info.Certifications.US ==~/PG-13/
|
def noTanInfantil = info.Certifications.US ==~/PG-13/ && info.Certifications.ES!="7"
|
||||||
if (!noTanInfantil) infantil = true
|
if (!noTanInfantil) infantil = true
|
||||||
}
|
}
|
||||||
else if (tieneAnimacion) {
|
else if (tieneAnimacion) {
|
||||||
if (tieneCertificacion) {
|
if (tieneCertificacion) {
|
||||||
infantil = info.Certifications.US=="G"
|
infantil = info.Certifications.US=="G"
|
||||||
|| info.Certifications.ES==~/Ai|APTA/
|
|| info.Certifications.ES==~/Ai|APTA/
|
||||||
|| info.Certifications.DE==~/0|6/
|
|| info.Certifications.DE==~/0/
|
||||||
|| info.Certifications.IT=="T"
|
|| info.Certifications.IT=="T"
|
||||||
|
|| info.Certifications.IE=="G"
|
||||||
|| info.Certifications.LT=="V" || info.Certifications.RU ==~ /6.+/
|
|| info.Certifications.LT=="V" || info.Certifications.RU ==~ /6.+/
|
||||||
|| info.Certifications.BR=="L"
|
|| info.Certifications.BR=="L"
|
||||||
|
|| info.Certifications.NO=="A"
|
||||||
|
|| info.Certifications.FR=="U"
|
||||||
} else {
|
} else {
|
||||||
def titulosInfantiles = ['Bonnie bears', 'The Jungle Bunch']
|
def titulosInfantiles = ['boonie bears', 'the jungle bunch']
|
||||||
if (titulosInfantiles.any { localize.English.n.toLowerCase()contains(it.toLowerCase()) })
|
if (titulosInfantiles.any { localize.English.n.toLowerCase().contains(it) })
|
||||||
infantil = true
|
infantil = true
|
||||||
}
|
}
|
||||||
} else if (!esFamiliar) {
|
} else if (!esFamiliar) {
|
||||||
|
@ -132,35 +103,66 @@ try { //empieza el script
|
||||||
esFamiliar = true //posem a familiar pelis de nens que no son animacio
|
esFamiliar = true //posem a familiar pelis de nens que no son animacio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tipoYaSeteado = esFamiliar || infantil
|
tipoYaSeteado = tipoYaSeteado || infantil
|
||||||
|
}
|
||||||
|
|
||||||
|
//animacion
|
||||||
|
def esAnimacion = tieneAnimacion && !infantil
|
||||||
|
tipoYaSeteado = tipoYaSeteado || esAnimacion
|
||||||
|
|
||||||
|
//*** española ***
|
||||||
|
def espanyola = false
|
||||||
|
def catalana = false
|
||||||
|
if (!tipoYaSeteado && info.ProductionCountries.contains("ES")) {
|
||||||
|
espanyola=
|
||||||
|
(numPaises==1 || (numPaises==2 && prodCountries.any{ it=~/AR|PT/ }))
|
||||||
|
|| { try { info.Network =~ /(?i)\bFLIXOL.\b|\b.?TVE\b/ } catch (e) { false } }()
|
||||||
|
|| ({ try { info.ProductionCompanies.any{it =~ /.?TVE|ESDIP|Canal Sur|Canal\+|Telecinco/}}catch(e){false}}() && llengu.size()==1?llengu[0]=="spa":false)
|
||||||
|
|| (info.Certifications.size()==1 && info.Certifications.ES!=null)
|
||||||
|
|| llengu.size()==1 && llengu[0]=="spa"
|
||||||
|
|| (movie.alternativeTitles.size()==1 && movie.alternativeTitles.ES!=null)
|
||||||
|
|| (country=="ES" && (!llengu.isEmpty() ? llengu.size()==1 && llengu[0]!="eng" : true))
|
||||||
|
if (espanyola) catalana = llengu.contains('cat')
|
||||||
|
tipoYaSeteado = tipoYaSeteado || espanyola
|
||||||
}
|
}
|
||||||
|
|
||||||
//asiaticas
|
//asiaticas
|
||||||
def asiatica = false
|
def asiatica = false
|
||||||
if (!tipoYaSeteado) {
|
if (!tipoYaSeteado) {
|
||||||
//asiaticas
|
def paisesAsiaticos = ["CN", "HK", "JP", "KP", "KR", "TH", "NP", "TW", "PH", "MO", "IN", "AE", "VN"]
|
||||||
if (numPaises>0) {
|
def paisesIntersec=0
|
||||||
def paisesAsiaticos = ["CN", "HK", "JP", "KP", "KR", "TH", "NP", "TW", "PH", "MO"]
|
def languajAsia = ["zho", "kor", "tha", "vie", "jpn", "ind", "vie"]
|
||||||
def languajAsia = ["zho", "kor", "thai", "vie", "jpn", "ind"]
|
def machingLanguages = languajAsia.intersect(llengu).size()
|
||||||
def matchP = paisesAsiaticos.intersect(info.ProductionCountries)
|
asiatica = machingLanguages == languajAsia.size()
|
||||||
asiatica = matchP.size() == numPaises
|
|| paisesAsiaticos.any{ country==it }
|
||||||
|| { llengu=normalLang(llengu); languajAsia.intersect(llengu).size() == languajAsia.size() }()
|
|| (numPaises != 0 && {((paisesIntersec=paisesAsiaticos.intersect(prodCountries).size()) == numPaises || (/*en observacion*/paisesIntersec!=0 && !llengu.contains('eng')) ) }())
|
||||||
|| { llengu.size()==1 && llengu[0]=~/esp|spa/}()
|
|| (languajAsia.any{audioLlengu.contains(it)} && prodCountries.any{paisesAsiaticos.contains(it)} && llengu.any{languajAsia.contains(it)} )
|
||||||
|
|| {try {director.contains("Takeshi Kitano")} catch (e) {false}}()
|
||||||
}
|
|| (machingLanguages > 0 && primaryTitle!=null && localize.English.n!=primaryTitle)
|
||||||
|
|
||||||
|
tipoYaSeteado = tipoYaSeteado || asiatica
|
||||||
}
|
}
|
||||||
|
|
||||||
//es animacion
|
//*** latina ***
|
||||||
def esAnimacion = tieneAnimacion && !esFamiliar
|
def latina = false
|
||||||
|
if (!tipoYaSeteado) {
|
||||||
|
def paisesLatinos = ["MX", "AR"]
|
||||||
|
latina = {try {paisesLatinos.contains(country)} catch (e) {false}}()
|
||||||
|
|| (numPaises != 0 && paisesLatinos.intersect(info.ProductionCountries).size() == numPaises)
|
||||||
|
|| info.productionCompanies.any{it=~/Corazón Films/}
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////
|
||||||
//tria
|
//tria
|
||||||
if (esDocu) ruta = ruta_docu
|
if (esDocu) ruta = ruta_docu
|
||||||
else if (esAnime) ruta = ruta_anime
|
else if (esAnime) ruta = ruta_anime
|
||||||
else if (infantil) ruta = ruta_infantil
|
else if (infantil) ruta = ruta_infantil
|
||||||
else if (esAnimacion) ruta = ruta_animacion
|
else if (esAnimacion) ruta = ruta_animacion
|
||||||
|
else if (catalana) ruta = ruta_cat
|
||||||
else if (espanyola) ruta = ruta_esp
|
else if (espanyola) ruta = ruta_esp
|
||||||
else if (esFamiliar) ruta = ruta_familiar
|
else if (latina) ruta = ruta_latina
|
||||||
else if (asiatica) ruta = ruta_asiaticas
|
else if (asiatica) ruta = ruta_asiaticas
|
||||||
|
else if (esFamiliar) ruta = ruta_familiar
|
||||||
else if (y<1980) ruta = ruta_classic
|
else if (y<1980) ruta = ruta_classic
|
||||||
else if (y<2000) ruta = ruta_retro
|
else if (y<2000) ruta = ruta_retro
|
||||||
if (ruta==rutaOK && y>=2021) ruta = ruta_estrenos
|
if (ruta==rutaOK && y>=2021) ruta = ruta_estrenos
|
||||||
|
@ -169,7 +171,7 @@ try { //empieza el script
|
||||||
|
|
||||||
/*** RESULTADO FINAL ***/
|
/*** RESULTADO FINAL ***/
|
||||||
def inicial = (ruta==rutaOK || ruta==ruta_retro) ? getInicial() : ''
|
def inicial = (ruta==rutaOK || ruta==ruta_retro) ? getInicial() : ''
|
||||||
def tmdb = ""//" {tmdb-"+tmdbid+"}"
|
def tmdb = " {tmdb-"+tmdbid+"}"
|
||||||
def carpetaPeli = localize.Spanish.plex.name + tmdb + '/'
|
def carpetaPeli = localize.Spanish.plex.name + tmdb + '/'
|
||||||
|
|
||||||
return ruta + inicial + carpetaPeli + fn
|
return ruta + inicial + carpetaPeli + fn
|
||||||
|
@ -212,4 +214,26 @@ try { //empieza el script
|
||||||
def resultado = rutaKO + rutaMotivoErr + msgErr + '/' + fn
|
def resultado = rutaKO + rutaMotivoErr + msgErr + '/' + fn
|
||||||
|
|
||||||
return resultado
|
return resultado
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************/
|
||||||
|
/********************************************************/
|
||||||
|
/************** 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 sanityCheck(newId) {
|
||||||
|
def oldId = fn.find(/\{tmdb-\d+\}/)?.find(/\d+/)
|
||||||
|
return oldId!=null ? oldId == newId.toString() : true
|
||||||
|
}
|
||||||
|
/***********/
|
|
@ -1,17 +1,16 @@
|
||||||
//by @xeviff
|
//by @xeviff
|
||||||
/* HARDCODED */
|
/* HARDCODED */
|
||||||
def ubuntu_desktop=true
|
def relocation = false
|
||||||
def relocation = true
|
def relocationFrom=null
|
||||||
def skipAudioCheck = true
|
def skipAudioCheck = true
|
||||||
/*************/
|
/*************/
|
||||||
|
|
||||||
/** RUTAS **/
|
/** RUTAS **/
|
||||||
|
|
||||||
|
|
||||||
def root = '/pelis/'
|
def root = '/pelis/'
|
||||||
def rutaOK = root+"Pelis/plain/"
|
def ruta2000 = root+"Pelis/plain/"
|
||||||
def ruta = rutaOK
|
def ruta = ruta2000
|
||||||
def ruta_docu = root+"Documentales/plain/"
|
def ruta_docu = root+"Documentales/plain/"
|
||||||
def ruta_anime = root+"Pelis_anime/plain/"
|
def ruta_anime = root+"Pelis_anime/"
|
||||||
def ruta_animacion = root+"Pelis_animacion/"
|
def ruta_animacion = root+"Pelis_animacion/"
|
||||||
def ruta_infantil = root+"Pelis_infantiles/"
|
def ruta_infantil = root+"Pelis_infantiles/"
|
||||||
def ruta_familiar = root+"Pelis_familiar/"
|
def ruta_familiar = root+"Pelis_familiar/"
|
||||||
|
@ -22,12 +21,9 @@ def ruta_retro = root+"Pelis_retro/plain/"
|
||||||
def ruta_estrenos = root+"Pelis_estrenos/plain/"
|
def ruta_estrenos = root+"Pelis_estrenos/plain/"
|
||||||
def ruta_classic = root+"Pelis_classic/"
|
def ruta_classic = root+"Pelis_classic/"
|
||||||
def ruta_asiaticas = root+"Pelis_asiaticas/"
|
def ruta_asiaticas = root+"Pelis_asiaticas/"
|
||||||
|
|
||||||
def rutaKO = root+"error/"
|
def rutaKO = root+"error/"
|
||||||
/**********/
|
/**********/
|
||||||
|
|
||||||
/** Audio (definición) **/
|
|
||||||
def hayEAC3=false
|
|
||||||
|
|
||||||
try { //empieza el script
|
try { //empieza el script
|
||||||
|
|
||||||
|
@ -38,15 +34,7 @@ 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 */
|
|
||||||
if (relocation && !sanityCheck(tmdbid)) return '@@@@@@ Names Sanity Check KO @@@@@@@ --> New name: '+localize.Spanish.n+' with tmdb='+tmdbid
|
|
||||||
try {
|
try {
|
||||||
video
|
video
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -57,6 +45,18 @@ try { //empieza el script
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new Exception("[genero_no_especificado]")
|
throw new Exception("[genero_no_especificado]")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//*** 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 */
|
||||||
|
if (relocation && !sanityCheck(tmdbid)) return '@@@@@@ Names Sanity Check KO @@@@@@@ --> New name: '+localize.Spanish.n+' with tmdb='+tmdbid
|
||||||
|
|
||||||
|
return 'hi'
|
||||||
/********************************/
|
/********************************/
|
||||||
|
|
||||||
/** Codec Vídeo: en nombre fichero **/
|
/** Codec Vídeo: en nombre fichero **/
|
||||||
|
@ -94,8 +94,7 @@ try { //empieza el script
|
||||||
/(?i)\bAMZN?\b|\bNF\b|\bHBO\b|\bHBO.?MAX\b|\bHMAX\b|\bHULU\b|\bA3P\b|\bDPLY\b|\bSTARZ\b|\bFILMIN\b|\bFLMN\b|\bNETFLIX\b|\bDSN.?\b|\bDSP+?\b|\bRTVE\b|\bFLIXOL.\b|\bM\+\b/ )
|
/(?i)\bAMZN?\b|\bNF\b|\bHBO\b|\bHBO.?MAX\b|\bHMAX\b|\bHULU\b|\bA3P\b|\bDPLY\b|\bSTARZ\b|\bFILMIN\b|\bFLMN\b|\bNETFLIX\b|\bDSN.?\b|\bDSP+?\b|\bRTVE\b|\bFLIXOL.\b|\bM\+\b/ )
|
||||||
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
|
}
|
||||||
formato_distribucion = '¿WEB-DL'
|
|
||||||
if (formato_distribucion!='') formato_distribucion=' '+formato_distribucion
|
if (formato_distribucion!='') formato_distribucion=' '+formato_distribucion
|
||||||
/**********************************/
|
/**********************************/
|
||||||
|
|
||||||
|
@ -201,7 +200,13 @@ try { //empieza el script
|
||||||
/**** Carpeta / tipo contenido ******************************************************************************/
|
/**** Carpeta / tipo contenido ******************************************************************************/
|
||||||
/*************************************************************************************************************/
|
/*************************************************************************************************************/
|
||||||
|
|
||||||
|
//inits
|
||||||
def tipoYaSeteado=false
|
def tipoYaSeteado=false
|
||||||
|
def prodCountries=info.ProductionCountries
|
||||||
|
def certifications=info.Certifications
|
||||||
|
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) {[]}}()
|
||||||
|
|
||||||
//animacion (no concluyente)
|
//animacion (no concluyente)
|
||||||
def tieneAnimacion = genres.any{ it =~ /Anima.i.n/}
|
def tieneAnimacion = genres.any{ it =~ /Anima.i.n/}
|
||||||
|
@ -211,9 +216,7 @@ try { //empieza el script
|
||||||
def esDocu = genres.any{ it =~ /Documental|Documentary|Reality/} && !(localize.English.n =~ /Jackass/)
|
def esDocu = genres.any{ it =~ /Documental|Documentary|Reality/} && !(localize.English.n =~ /Jackass/)
|
||||||
//Anime ---------- (Animacion encara no es pot perquè depen del infantil)
|
//Anime ---------- (Animacion encara no es pot perquè depen del infantil)
|
||||||
def esAnime = false
|
def esAnime = false
|
||||||
def numPaises = info.ProductionCountries.size()
|
if (tieneAnimacion && prodCountries.contains("JP") && (!llengu.isEmpty() ? llengu.contains('jpn') : true)) {
|
||||||
def llengu = normalLang()
|
|
||||||
if (tieneAnimacion && info.ProductionCountries.contains("JP") && llengu.contains('jpn')) {
|
|
||||||
esAnime = (numPaises==1 || anime || country=="JP")
|
esAnime = (numPaises==1 || anime || country=="JP")
|
||||||
&& ["nemo"].any{!localize.English.n.toLowerCase().contains(it)}
|
&& ["nemo"].any{!localize.English.n.toLowerCase().contains(it)}
|
||||||
}
|
}
|
||||||
|
@ -224,23 +227,23 @@ try { //empieza el script
|
||||||
def infantil = false
|
def infantil = false
|
||||||
|
|
||||||
if (!tipoYaSeteado) {
|
if (!tipoYaSeteado) {
|
||||||
def tieneCertificacion = info.Certifications!=null && info.Certifications.size()!=0
|
def tieneCertificacion = certifications!=null && certifications.size()!=0
|
||||||
|
|
||||||
if (tieneFamiliar && tieneAnimacion) {
|
if (tieneFamiliar && tieneAnimacion) {
|
||||||
def noTanInfantil = info.Certifications.US ==~/PG-13/ && info.Certifications.ES!="7"
|
def noTanInfantil = certifications.US ==~/PG-13/ && certifications.ES!="7"
|
||||||
if (!noTanInfantil) infantil = true
|
if (!noTanInfantil) infantil = true
|
||||||
}
|
}
|
||||||
else if (tieneAnimacion) {
|
else if (tieneAnimacion) {
|
||||||
if (tieneCertificacion) {
|
if (tieneCertificacion) {
|
||||||
infantil = info.Certifications.US=="G"
|
infantil = certifications.US=="G"
|
||||||
|| info.Certifications.ES==~/Ai|APTA/
|
|| certifications.ES==~/Ai|APTA/
|
||||||
|| info.Certifications.DE==~/0/
|
|| certifications.DE==~/0/
|
||||||
|| info.Certifications.IT=="T"
|
|| certifications.IT=="T"
|
||||||
|| info.Certifications.IE=="G"
|
|| certifications.IE=="G"
|
||||||
|| info.Certifications.LT=="V" || info.Certifications.RU ==~ /6.+/
|
|| certifications.LT=="V" || certifications.RU ==~ /6.+/
|
||||||
|| info.Certifications.BR=="L"
|
|| certifications.BR=="L"
|
||||||
|| info.Certifications.NO=="A"
|
|| certifications.NO=="A"
|
||||||
|| info.Certifications.FR=="U"
|
|| certifications.FR=="U"
|
||||||
} else {
|
} else {
|
||||||
def titulosInfantiles = ['boonie bears', 'the jungle bunch']
|
def titulosInfantiles = ['boonie bears', 'the jungle bunch']
|
||||||
if (titulosInfantiles.any { localize.English.n.toLowerCase().contains(it) })
|
if (titulosInfantiles.any { localize.English.n.toLowerCase().contains(it) })
|
||||||
|
@ -248,7 +251,7 @@ try { //empieza el script
|
||||||
}
|
}
|
||||||
} else if (!esFamiliar) {
|
} else if (!esFamiliar) {
|
||||||
if (tieneCertificacion && (
|
if (tieneCertificacion && (
|
||||||
info.Certifications.US=="G"
|
certifications.US=="G"
|
||||||
)) {
|
)) {
|
||||||
esFamiliar = true //posem a familiar pelis de nens que no son animacio
|
esFamiliar = true //posem a familiar pelis de nens que no son animacio
|
||||||
}
|
}
|
||||||
|
@ -263,13 +266,13 @@ try { //empieza el script
|
||||||
//*** española ***
|
//*** española ***
|
||||||
def espanyola = false
|
def espanyola = false
|
||||||
def catalana = false
|
def catalana = false
|
||||||
if (!tipoYaSeteado && info.ProductionCountries.contains("ES")) {
|
if (!tipoYaSeteado && prodCountries.contains("ES")) {
|
||||||
espanyola=
|
espanyola=
|
||||||
(numPaises==1 || (numPaises==2 && info.ProductionCountries.any{ it=~/AR|PT/ }))
|
(numPaises==1 || (numPaises==2 && prodCountries.any{ it=~/AR|PT/ }))
|
||||||
|| { try { info.Network =~ /(?i)\bFLIXOL.\b|\b.?TVE\b/ } catch (e) { false } }()
|
|| { try { info.Network =~ /(?i)\bFLIXOL.\b|\b.?TVE\b/ } catch (e) { false } }()
|
||||||
|| { try { info.ProductionCompanies.any{ it =~ /.?TVE|ESDIP|Canal Sur|Canal\+|Telecinco/ } } catch (e) { false } }()
|
|| ({ try { info.ProductionCompanies.any{it =~ /.?TVE|ESDIP|Canal Sur|Canal\+|Telecinco/}}catch(e){false}}() && llengu.size()==1?llengu[0]=="spa":false)
|
||||||
|| (info.Certifications.size()==1 && info.Certifications.ES!=null)
|
|| (info.Certifications.size()==1 && info.Certifications.ES!=null)
|
||||||
|| llengu.size()==1 && llengu[0]=~/esp|spa/
|
|| llengu.size()==1 && llengu[0]=="spa"
|
||||||
|| (movie.alternativeTitles.size()==1 && movie.alternativeTitles.ES!=null)
|
|| (movie.alternativeTitles.size()==1 && movie.alternativeTitles.ES!=null)
|
||||||
|| (country=="ES" && (!llengu.isEmpty() ? llengu.size()==1 && llengu[0]!="eng" : true))
|
|| (country=="ES" && (!llengu.isEmpty() ? llengu.size()==1 && llengu[0]!="eng" : true))
|
||||||
if (espanyola) catalana = llengu.contains('cat')
|
if (espanyola) catalana = llengu.contains('cat')
|
||||||
|
@ -282,10 +285,12 @@ try { //empieza el script
|
||||||
def paisesAsiaticos = ["CN", "HK", "JP", "KP", "KR", "TH", "NP", "TW", "PH", "MO"]
|
def paisesAsiaticos = ["CN", "HK", "JP", "KP", "KR", "TH", "NP", "TW", "PH", "MO"]
|
||||||
def paisesIntersec=0
|
def paisesIntersec=0
|
||||||
def languajAsia = ["zho", "kor", "thai", "vie", "jpn", "ind"]
|
def languajAsia = ["zho", "kor", "thai", "vie", "jpn", "ind"]
|
||||||
asiatica = (numPaises != 0 && {((paisesIntersec=paisesAsiaticos.intersect(info.ProductionCountries).size()) == numPaises || (/*en observacion*/paisesIntersec!=0 && !llengu.contains('eng')) ) }())
|
asiatica = languajAsia.intersect(llengu).size() == languajAsia.size()
|
||||||
|| languajAsia.intersect(llengu).size() == languajAsia.size()
|
|| paisesAsiaticos.any{ country==it }
|
||||||
//|| {try { languages.any{ languajAsia.contains(it.toString()) } } catch (err) {false} }()
|
|| (numPaises != 0 && {((paisesIntersec=paisesAsiaticos.intersect(prodCountries).size()) == numPaises || (/*en observacion*/paisesIntersec!=0 && !llengu.contains('eng')) ) }())
|
||||||
//|| matchP.size()>0 && englishAudios.isEmpty() && audio.size()>1 /*en obseracion*/
|
|| (languajAsia.any{bloqueAudio.contains(it)} && prodCountries.any{paisesAsiaticos.contains(it)} && llengu.any{languajAsia.contains(it)} )
|
||||||
|
|| {try {director.contains("Takeshi Kitano")} catch (e) {false}}()
|
||||||
|
|
||||||
tipoYaSeteado = tipoYaSeteado || asiatica
|
tipoYaSeteado = tipoYaSeteado || asiatica
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,7 +299,7 @@ try { //empieza el script
|
||||||
if (!tipoYaSeteado) {
|
if (!tipoYaSeteado) {
|
||||||
def paisesLatinos = ["MX", "AR"]
|
def paisesLatinos = ["MX", "AR"]
|
||||||
latina = {try {paisesLatinos.contains(country)} catch (e) {false}}()
|
latina = {try {paisesLatinos.contains(country)} catch (e) {false}}()
|
||||||
|| (numPaises != 0 && paisesLatinos.intersect(info.ProductionCountries).size() == numPaises)
|
|| (numPaises != 0 && paisesLatinos.intersect(prodCountries).size() == numPaises)
|
||||||
|| info.productionCompanies.any{it=~/Corazón Films/}
|
|| info.productionCompanies.any{it=~/Corazón Films/}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,16 +312,23 @@ try { //empieza el script
|
||||||
else if (catalana) ruta = ruta_cat
|
else if (catalana) ruta = ruta_cat
|
||||||
else if (espanyola) ruta = ruta_esp
|
else if (espanyola) ruta = ruta_esp
|
||||||
else if (latina) ruta = ruta_latina
|
else if (latina) ruta = ruta_latina
|
||||||
else if (esFamiliar) ruta = ruta_familiar
|
|
||||||
else if (asiatica) ruta = ruta_asiaticas
|
else if (asiatica) ruta = ruta_asiaticas
|
||||||
|
else if (esFamiliar) ruta = ruta_familiar
|
||||||
else if (y<1980) ruta = ruta_classic
|
else if (y<1980) ruta = ruta_classic
|
||||||
else if (y<2000) ruta = ruta_retro
|
else if (y<2000) ruta = ruta_retro
|
||||||
if (ruta==rutaOK && y>=2021) ruta = ruta_estrenos
|
if (ruta==ruta2000 && y>=2021) ruta = ruta_estrenos
|
||||||
/********************************************/
|
/********************************************/
|
||||||
|
//Relocation possible failures
|
||||||
|
if (relocation && relocationFrom!=null) {
|
||||||
|
if (!ruta.contains(relocationFrom)) {
|
||||||
|
ruta = relocationFrom + "to_observe/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//**//
|
||||||
|
|
||||||
/*** RESULTADO FINAL ***/
|
/*** RESULTADO FINAL ***/
|
||||||
def nombrePelicula_formatoPlex = {try { catalana ? localize.Catalan.n : localize.Spanish.plex.name } catch (err) {localize.Spanish.plex.name} }()
|
def nombrePelicula_formatoPlex = {try { catalana ? localize.Catalan.n : localize.Spanish.plex.name } catch (err) {localize.Spanish.plex.name} }()
|
||||||
def inicial = (ruta==rutaOK || ruta==ruta_retro) ? getInicial() : ''
|
def inicial = (ruta==ruta2000 || ruta==ruta_retro) ? getInicial() : ''
|
||||||
def tmdb = "{tmdb-"+tmdbid+"}"
|
def tmdb = "{tmdb-"+tmdbid+"}"
|
||||||
def carpetaPeli = localize.Spanish.plex.name + ' ' + tmdb + '/'
|
def carpetaPeli = localize.Spanish.plex.name + ' ' + tmdb + '/'
|
||||||
def nomPrincipal = nombrePelicula_formatoPlex + bloqueVideo + bloqueAudio + bloqueSubs
|
def nomPrincipal = nombrePelicula_formatoPlex + bloqueVideo + bloqueAudio + bloqueSubs
|
||||||
|
@ -328,11 +340,9 @@ try { //empieza el script
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
def msgErr = err.getMessage()
|
def msgErr = err.getMessage()
|
||||||
|
|
||||||
if (ubuntu_desktop) {
|
String str= err.getStackTrace().toString()
|
||||||
String str= err.getStackTrace().toString()
|
def pattern = ( str =~ /groovy.(\d+)./ )
|
||||||
def pattern = ( str =~ /groovy.(\d+)./ )
|
return " Error at line number = " + pattern[0][1] + ". more: "+msgErr
|
||||||
return " Error at line number = " + pattern[0][1] + ". more: "+msgErr
|
|
||||||
}
|
|
||||||
|
|
||||||
def rutaMotivoErr
|
def rutaMotivoErr
|
||||||
|
|
||||||
|
@ -449,10 +459,6 @@ def getInicial () {
|
||||||
def inicial = iniClear.replaceAll(/[0-9]/,'#')+'/'
|
def inicial = iniClear.replaceAll(/[0-9]/,'#')+'/'
|
||||||
return inicial
|
return inicial
|
||||||
}
|
}
|
||||||
def normalLang() {
|
|
||||||
def langs=[]
|
|
||||||
return {try { for (lan in languages) langs.add(lan.toString()); return langs } catch(err) {langs}}()
|
|
||||||
}
|
|
||||||
def sanityCheck(newId) {
|
def sanityCheck(newId) {
|
||||||
def oldId = fn.find(/\{tmdb-\d+\}/)?.find(/\d+/)
|
def oldId = fn.find(/\{tmdb-\d+\}/)?.find(/\d+/)
|
||||||
return oldId!=null ? oldId == newId.toString() : true
|
return oldId!=null ? oldId == newId.toString() : true
|
|
@ -0,0 +1,39 @@
|
||||||
|
/** AUDIO (ejecución) **/
|
||||||
|
def bloqueAudio=''
|
||||||
|
def audiosMap = [:]
|
||||||
|
for (aud in audio) {
|
||||||
|
def shortDesc = aud.Language_String3 !=null ? aud.Language_String3
|
||||||
|
: aud.Title!=null ? (aud.Title=~/(?i).+spa.+/?'spa': aud.Title.substring(0,3).toLowerCase()) : 'und'
|
||||||
|
if (aud.Title!=null && aud.Title=~/(?i).*latin.*/) shortDesc='lat'
|
||||||
|
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
|
||||||
|
def v = audioElms.value
|
||||||
|
if (!k.contains('+') && countAudiosInMap(v)>1) k += '+'
|
||||||
|
def mQ = getMaxQuality(v)
|
||||||
|
def mQstr = (mQ==null || mQ.isEmpty()) ? 'und' : printAudio(mQ)
|
||||||
|
if (groupedAudiosMap.containsKey(mQstr)) groupedAudiosMap[mQstr].add(k)
|
||||||
|
else groupedAudiosMap[mQstr] = [k]
|
||||||
|
}
|
||||||
|
audiosMap=null
|
||||||
|
def temp=''
|
||||||
|
for (audioGroup in groupedAudiosMap) {
|
||||||
|
def k = audioGroup.key
|
||||||
|
def v = audioGroup.value
|
||||||
|
def gS = v.size()
|
||||||
|
def str=''
|
||||||
|
for (int i=0; i<gS; i++) {
|
||||||
|
str += (v[i]!=null?v[i]:'und') +', '
|
||||||
|
if (i==gS-1) {
|
||||||
|
str = removeLastComa(str)+' '
|
||||||
|
str += k+', '
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bloqueAudio += str
|
||||||
|
}
|
||||||
|
groupedAudiosMap=null
|
||||||
|
bloqueAudio = '['+removeLastComa(bloqueAudio)+']'
|
|
@ -0,0 +1,40 @@
|
||||||
|
} catch (err) {
|
||||||
|
def msgErr = err.getMessage()
|
||||||
|
def lineHintWorks = false
|
||||||
|
if (lineHintWorks) {
|
||||||
|
String str= err.getStackTrace().toString()
|
||||||
|
def pattern = ( str =~ /groovy.(\d+)./ )
|
||||||
|
return " Error at line number = " + pattern[0][1] + ". more: "+msgErr
|
||||||
|
}
|
||||||
|
|
||||||
|
def rutaMotivoErr
|
||||||
|
|
||||||
|
if (msgErr=="[formato_fichero_noestarndar]" || msgErr=="[video_roto]")
|
||||||
|
rutaMotivoErr="/fichero/"
|
||||||
|
else if (msgErr=="[genero_no_especificado]" || msgErr=="[certificado_edad_no_especificado]") {
|
||||||
|
rutaMotivoErr="/themoviedb/"
|
||||||
|
} else if (msgErr.startsWith("[idioma_audio")) {
|
||||||
|
rutaMotivoErr="/audio/"
|
||||||
|
} else {
|
||||||
|
def errSplitted = msgErr.split("\\-")
|
||||||
|
return msgErr
|
||||||
|
if (errSplitted==null) {
|
||||||
|
rutaMotivoErr="/error_desconocido/"
|
||||||
|
} else {
|
||||||
|
def errType = errSplitted[0]
|
||||||
|
if (errType=="[formato_audio_no_encontrado")
|
||||||
|
rutaMotivoErr="/audio/"
|
||||||
|
else if (errType.startsWith("[idioma_audio"))
|
||||||
|
rutaMotivoErr="/idioma/"
|
||||||
|
else {
|
||||||
|
String str2= err.getStackTrace().toString()
|
||||||
|
def pattern2 = ( str2 =~ /groovy.(\d+)./ )
|
||||||
|
return " Error at line number = " + pattern2[0][1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def resultado = rutaKO + rutaMotivoErr + msgErr + '/' + localize.English.plex.name + '/' + fn
|
||||||
|
|
||||||
|
return resultado
|
||||||
|
}
|
|
@ -0,0 +1,161 @@
|
||||||
|
/*************************************************************************************************************/
|
||||||
|
/**** Carpeta / tipo contenido ******************************************************************************/
|
||||||
|
/*************************************************************************************************************/
|
||||||
|
|
||||||
|
//inits
|
||||||
|
def tipoYaSeteado=false
|
||||||
|
def prodCountries=info.ProductionCountries
|
||||||
|
def certifications=info.Certifications
|
||||||
|
def pais = {try{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) {[]}}()
|
||||||
|
|
||||||
|
//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 =~ /Jackass/)
|
||||||
|
//Anime ---------- (Animacion encara no es pot perquè depen del infantil)
|
||||||
|
def esAnime = false
|
||||||
|
if (tieneAnimacion && prodCountries.contains("JP") && (!llengu.isEmpty() ? llengu.contains('jpn') : true)) {
|
||||||
|
esAnime = (numPaises==1 || anime || pais=="JP")
|
||||||
|
&& ["nemo"].any{!localize.English.n.toLowerCase().contains(it)}
|
||||||
|
}
|
||||||
|
tipoYaSeteado = esDocu || esAnime
|
||||||
|
|
||||||
|
//***** familiar vs infantil ****
|
||||||
|
def esFamiliar = tieneFamiliar
|
||||||
|
def infantil = false
|
||||||
|
|
||||||
|
if (!tipoYaSeteado) {
|
||||||
|
def tieneCertificacion = certifications!=null && certifications.size()!=0
|
||||||
|
|
||||||
|
if (tieneFamiliar && tieneAnimacion) {
|
||||||
|
def noTanInfantil = certifications.US ==~/PG-13/ && certifications.ES!="7"
|
||||||
|
if (!noTanInfantil) infantil = true
|
||||||
|
}
|
||||||
|
else if (tieneAnimacion) {
|
||||||
|
if (tieneCertificacion) {
|
||||||
|
infantil = 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
|
||||||
|
tipoYaSeteado = tipoYaSeteado || esAnimacion
|
||||||
|
|
||||||
|
//*** española / catalana ***
|
||||||
|
def catalana = false
|
||||||
|
def espanyola = false
|
||||||
|
if (!tipoYaSeteado && prodCountries.contains("ES")) {
|
||||||
|
espanyola=
|
||||||
|
(numPaises==1 || (numPaises==2 && prodCountries.any{ it=~/AR|PT/ }))
|
||||||
|
|| { try { info.Network =~ /(?i)\bFLIXOL.\b|\b.?TVE\b/ } catch (e) { false } }()
|
||||||
|
|| ({ try { info.ProductionCompanies.any{it =~ /.?TVE|ESDIP|Canal Sur|Canal\+|Telecinco/}}catch(e){false}}() && (llengu.size()==1?llengu[0]=="spa":true))
|
||||||
|
|| (certifications.size()==1 && certifications.ES!=null)
|
||||||
|
|| (llengu.size()==1 && llengu[0]=="spa")
|
||||||
|
|| (movie.alternativeTitles.size()==1 && movie.alternativeTitles.ES!=null)
|
||||||
|
|| (pais=="ES" && (!llengu.isEmpty() ? llengu.size()==1 && llengu[0]=="spa" : true))
|
||||||
|
|
||||||
|
catalana = llengu.contains('cat')
|
||||||
|
|
||||||
|
tipoYaSeteado = tipoYaSeteado || espanyola || catalana
|
||||||
|
}
|
||||||
|
|
||||||
|
//asiaticas
|
||||||
|
def asiatica = false
|
||||||
|
if (!tipoYaSeteado) {
|
||||||
|
def paisesAsiaticos = ["CN", "HK", "JP", "KP", "KR", "TH", "NP", "TW", "PH", "MO", "SU"]
|
||||||
|
def paisesIntersec=0
|
||||||
|
def languajAsia = ["zho", "kor", "thai", "vie", "jpn", "ind", "rus"]
|
||||||
|
def machingLanguages = languajAsia.intersect(llengu).size()
|
||||||
|
asiatica = machingLanguages == languajAsia.size()
|
||||||
|
|| paisesAsiaticos.any{ pais==it }
|
||||||
|
|| (numPaises != 0 && {((paisesIntersec=paisesAsiaticos.intersect(prodCountries).size()) == numPaises || (/*en observacion*/paisesIntersec!=0 && !llengu.contains('eng')) ) }())
|
||||||
|
|| (languajAsia.any{audioLlengu.contains(it)} && prodCountries.any{paisesAsiaticos.contains(it)} && llengu.any{languajAsia.contains(it)} )
|
||||||
|
|| {try {director.contains("Takeshi Kitano")} catch (e) {false}}()
|
||||||
|
|| (machingLanguages > 0 && primaryTitle!=null && localize.English.n!=primaryTitle)
|
||||||
|
|
||||||
|
tipoYaSeteado = tipoYaSeteado || asiatica
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//*** latina ***
|
||||||
|
def latina = false
|
||||||
|
if (!tipoYaSeteado) {
|
||||||
|
def paisesLatinos = ["MX", "AR"]
|
||||||
|
latina = {try {paisesLatinos.contains(pais)} catch (e) {false}}()
|
||||||
|
|| (numPaises != 0 && paisesLatinos.intersect(prodCountries).size() == numPaises)
|
||||||
|
|| prodCountries.any{it=~/Corazón Films/}
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////
|
||||||
|
//tria
|
||||||
|
if (esDocu) ruta = ruta_docu
|
||||||
|
else if (esAnime) ruta = ruta_anime
|
||||||
|
else if (infantil) ruta = ruta_infantil
|
||||||
|
else if (esAnimacion) ruta = ruta_animacion
|
||||||
|
else if (catalana) ruta = ruta_cat
|
||||||
|
else if (espanyola) ruta = ruta_esp
|
||||||
|
else if (latina) ruta = ruta_latina
|
||||||
|
else if (asiatica) ruta = ruta_asiaticas
|
||||||
|
else if (esFamiliar && y>1970) ruta = ruta_familiar
|
||||||
|
else if (y<1980) ruta = ruta_classic
|
||||||
|
else if (y<2000) ruta = ruta_retro
|
||||||
|
if (ruta==ruta2000) {
|
||||||
|
if (y>=2021) ruta = ruta_estrenos
|
||||||
|
else if (y>=2010) ruta += "2010-2020/"
|
||||||
|
else ruta += "2000-2010/"
|
||||||
|
}
|
||||||
|
/********************************************/
|
||||||
|
|
||||||
|
//----------------------------
|
||||||
|
//Relocation possible failures
|
||||||
|
if (relocation && {try {relocationFrom!=null} catch (err) {false}}()) {
|
||||||
|
if (!ruta.contains(relocationFrom)) {
|
||||||
|
ruta = root + relocationFrom + "to_observe/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------
|
||||||
|
|
||||||
|
/*** RESULTADO FINAL ***/
|
||||||
|
def inicial = (ruta==ruta_retro) ? getInicial() : ''
|
||||||
|
def tmdb = "{tmdb-"+tmdbid+"}"
|
||||||
|
def carpetaPeli = localize.Spanish.plex.name + ' ' + tmdb + '/'
|
||||||
|
|
||||||
|
def file
|
||||||
|
if ({try {only_relocate} catch (err) {false}}()) {
|
||||||
|
file = fn
|
||||||
|
} else {
|
||||||
|
def nombrePelicula_formatoPlex = {try { catalana ? localize.Catalan.n : localize.Spanish.plex.name } catch (err) {localize.Spanish.plex.name} }()
|
||||||
|
def nomPrincipal = nombrePelicula_formatoPlex + bloqueVideo + bloqueAudio + bloqueSubs
|
||||||
|
def trackerCatch = fn.find(/(?i)\bHDO(limpo)?\b|\bRedBits\b/)
|
||||||
|
def tracker = trackerCatch != null ? '['+trackerCatch.replace("HDOlimpo", "HDO")+']' : ''
|
||||||
|
|
||||||
|
file = nomPrincipal + tracker + tmdb
|
||||||
|
}
|
||||||
|
|
||||||
|
return ruta + inicial + carpetaPeli + file
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
|
@ -0,0 +1,87 @@
|
||||||
|
|
||||||
|
/********************************************************/
|
||||||
|
/********************************************************/
|
||||||
|
/************** FUNCIONES *******************************/
|
||||||
|
/********************************************************/
|
||||||
|
/********************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/********* AUDIO *****************/
|
||||||
|
def removeLastComa(txt) {
|
||||||
|
return txt.substring(0, txt.size()-2)
|
||||||
|
}
|
||||||
|
def getMaxQuality (mapAudioIndexedByFormat) {
|
||||||
|
def formatSet = ["PCM", "MLP FBA" ,"DTS", "FLAC", "AC-3", "E-AC-3", "EAC3", "AAC", "MPEG Audio", "MP3"]
|
||||||
|
for (cFormat in formatSet) {
|
||||||
|
if (mapAudioIndexedByFormat.containsKey(cFormat)){
|
||||||
|
def difChannelsList = mapAudioIndexedByFormat[cFormat]
|
||||||
|
return difChannelsList.size()==1 ? difChannelsList[0] : getBestChannelFromList(difChannelsList)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
def printAudio (audio2Print) {
|
||||||
|
def format = audio2Print.Format
|
||||||
|
def fCom = audio2Print.Format_Commercial
|
||||||
|
switch (format) {
|
||||||
|
case "AC-3" -> fCom = "DD"
|
||||||
|
case "E-AC-3" -> fCom = "DD+"
|
||||||
|
case "MPEG Audio" -> fCom = "MPEG"
|
||||||
|
case "DTS" -> { if (fCom.contains("Master Audio")) fCom="DTS_MA"
|
||||||
|
else if (fCom.contains("DTS-HD High Resolution Audio")) fCom="DTS_HRA"
|
||||||
|
else if (fCom.contains("DTS-ES")) fCom="DTS-ES"
|
||||||
|
}
|
||||||
|
case "MLP FBA" -> {def tmp = "D_HD"; if (fCom.contains("Atmos")) tmp+="_Atmos"; fCom = tmp}
|
||||||
|
}
|
||||||
|
def canales = audio2Print.Channels.replace(2:'2.0', 6:'5.1', 7:'6.1', 8:'7.1')
|
||||||
|
return fCom + ' ' + canales
|
||||||
|
}
|
||||||
|
def getBestChannelFromList (audiosFormatFound) {
|
||||||
|
def bestChanel
|
||||||
|
def currentValue=0
|
||||||
|
for (myAudio2 in audiosFormatFound) {
|
||||||
|
if (myAudio2.Channels>currentValue) {
|
||||||
|
currentValue = myAudio2.Channels
|
||||||
|
bestChanel = myAudio2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bestChanel
|
||||||
|
}
|
||||||
|
def countAudiosInMap(audMap){
|
||||||
|
int count=0
|
||||||
|
for (aud in audMap) count += aud.value.size()
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
/********* SUBS ***************/
|
||||||
|
def handleSub(sub, capturedSubs) {
|
||||||
|
def lang = sub.Language_String3 !=null ? sub.Language_String3
|
||||||
|
: (sub.Title=~/(?i).+spa.+/?'spa': sub.Title.substring(0,3).toLowerCase())
|
||||||
|
if (sub.Title!=null && sub.Title=~/(?i).*latin.*/) lang='lat'
|
||||||
|
def forced = sub.title!=null ? sub.title.toLowerCase().contains("forzado") : false
|
||||||
|
if (!capturedSubs.containsKey(lang)) {
|
||||||
|
capturedSubs[lang] = lang+(forced?' F':'')
|
||||||
|
} else {
|
||||||
|
def existing=capturedSubs[lang]
|
||||||
|
def newTxt=''+existing
|
||||||
|
if (!existing.contains('+')) newTxt += '+'
|
||||||
|
if (forced && !existing.contains('F')) newTxt += ' F'
|
||||||
|
capturedSubs[lang]=newTxt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********/
|
||||||
|
/* 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 sanityCheck(newId) {
|
||||||
|
def oldId = fn.find(/\{tmdb-\d+\}/)?.find(/\d+/)
|
||||||
|
return oldId!=null ? oldId == newId.toString() : true
|
||||||
|
}
|
||||||
|
/***********/
|
|
@ -0,0 +1,5 @@
|
||||||
|
/* variables */
|
||||||
|
def relocation = false
|
||||||
|
def relocationFrom=null
|
||||||
|
def skipAudioCheck = false
|
||||||
|
/*************/
|
|
@ -0,0 +1,4 @@
|
||||||
|
/* variables */
|
||||||
|
def relocation = true
|
||||||
|
def skipAudioCheck = true
|
||||||
|
/*************/
|
|
@ -0,0 +1,21 @@
|
||||||
|
/** RUTAS **/
|
||||||
|
def root = '/pelis/'
|
||||||
|
def ruta2000 = root+"Pelis/"
|
||||||
|
def ruta = ruta2000
|
||||||
|
def ruta_docu = root+"Documentales/plain/"
|
||||||
|
def ruta_anime = root+"Pelis_anime/"
|
||||||
|
def ruta_animacion = root+"Pelis_animacion/"
|
||||||
|
def ruta_infantil = root+"Pelis_infantiles/"
|
||||||
|
def ruta_familiar = root+"Pelis_familiar/"
|
||||||
|
def ruta_esp = root+"Pelis_esp/plain/"
|
||||||
|
def ruta_latina = root+"Pelis_lat/"
|
||||||
|
def ruta_cat = root+"Pelis_cat/"
|
||||||
|
def ruta_retro = root+"Pelis_retro/plain/"
|
||||||
|
def ruta_estrenos = root+"Pelis_estrenos/plain/"
|
||||||
|
def ruta_classic = root+"Pelis_classic/"
|
||||||
|
def ruta_asiaticas = root+"Pelis_asiaticas/"
|
||||||
|
def rutaKO = root+"error/"
|
||||||
|
/**********/
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
/***** subtitulos *******/
|
||||||
|
def bloqueSubs
|
||||||
|
try {
|
||||||
|
def capturedSubs = [:]
|
||||||
|
bloqueSubs = '['
|
||||||
|
for (int s; s<text.size(); s++){
|
||||||
|
if (text[s]==null || s>10) break;
|
||||||
|
handleSub(text[s], capturedSubs);
|
||||||
|
}
|
||||||
|
def keysList = capturedSubs.keySet().toList()
|
||||||
|
for (index in 0..< keysList.size()) {
|
||||||
|
if (index>3){ bloqueSubs+='etc '; break; }
|
||||||
|
bloqueSubs += capturedSubs.get(keysList[index]).replace('null','und').replace(" F+","+F").replace("+ F","+F") + ', '
|
||||||
|
}
|
||||||
|
bloqueSubs = removeLastComa(bloqueSubs)+']'
|
||||||
|
}catch(err){bloqueSubs=''}
|
||||||
|
/************************/
|
|
@ -0,0 +1,32 @@
|
||||||
|
/** Tipo de archivo incorrecto **/
|
||||||
|
if (ext==~/jpg|nfo|png|url/) {
|
||||||
|
return fn
|
||||||
|
}
|
||||||
|
else if (ext!="mkv" && ext!="avi" && ext!="mp4") {
|
||||||
|
throw new Exception("[formato_fichero_noestarndar]")
|
||||||
|
}
|
||||||
|
//video problems
|
||||||
|
try {
|
||||||
|
video
|
||||||
|
} catch (e) {
|
||||||
|
throw new Exception("[video_roto]")
|
||||||
|
}
|
||||||
|
//no genere
|
||||||
|
try {
|
||||||
|
genres
|
||||||
|
} catch (err) {
|
||||||
|
throw new Exception("[genero_no_especificado]")
|
||||||
|
}
|
||||||
|
|
||||||
|
//*** 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 (vf ==~ '2160.' || (es1080 && es1080Remux)) return "/pelis/to_transcode/"+fn
|
||||||
|
|
||||||
|
/* SANITY CHECK */
|
||||||
|
if (relocation && !sanityCheck(tmdbid))
|
||||||
|
return root + relocationFrom + "to_check_name/"
|
||||||
|
//return '@@@@@@ Names Sanity Check KO @@@@@@@ --> New name: '+localize.Spanish.n+' with tmdb='+tmdbid
|
||||||
|
/********************************/
|
|
@ -0,0 +1,76 @@
|
||||||
|
/** Codec Vídeo: en nombre fichero **/
|
||||||
|
def codecVideo = (any{vc}{0} =~ /HEVC|265|ATEME/ ) ? 'HEVC' :
|
||||||
|
(any{vc}{0} =~ /264/) ? 'AVC' : vc
|
||||||
|
/**************/
|
||||||
|
|
||||||
|
/******* Calidad ******/
|
||||||
|
def calidad =
|
||||||
|
(vf =~ '2160.') ? //4K
|
||||||
|
(peso > 30 && numericBps >= 26000000)
|
||||||
|
? "UHDRemux"
|
||||||
|
: (peso > 15)
|
||||||
|
? "UHDRip"
|
||||||
|
: "microUHD"
|
||||||
|
: es1080 ? //1080
|
||||||
|
es1080Remux
|
||||||
|
? vf+" BDRemux"
|
||||||
|
: (numericBps > 8000000)
|
||||||
|
? vf
|
||||||
|
: "microHD"
|
||||||
|
: vf
|
||||||
|
def fuente = {try{ source } catch(err){null}}()
|
||||||
|
if (fuente!=null) calidad = calidad.startsWith("micro") ? calidad : vf
|
||||||
|
|
||||||
|
/***************************/
|
||||||
|
/** Formato distribución **/
|
||||||
|
formato_distribucion = fuente!=null ? fuente : relocation ? '' :
|
||||||
|
fn=~/(?i)\bblu.?ray\b|\bbdrip\b/ ? (calidad=~/(?i).+rip/ ? '' : 'BDRip') :
|
||||||
|
fn=~/(?i)remux/ ? (calidad=~/(?i).+remux/ ? '' : 'BDRemux') :
|
||||||
|
fn=~/(?i)\bWEB.??(DL|RIP)\b/ ? 'WEB-DL' :
|
||||||
|
''
|
||||||
|
if (formato_distribucion=='WEB-DL') {
|
||||||
|
def plataforma = fn.find( //coge el contenido que encaja
|
||||||
|
/(?i)\bAMZN?\b|\bNF\b|\bHBO\b|\bHBO.?MAX\b|\bHMAX\b|\bHULU\b|\bA3P\b|\bDPLY\b|\bSTARZ\b|\bFILMIN\b|\bFLMN\b|\bNETFLIX\b|\bDSN.?\b|\bDSP+?\b|\bRTVE\b|\bFLIXOL.\b|\bM\+\b/ )
|
||||||
|
if (plataforma!=null) plataforma = plataforma.replace("MVPLUS","MV+")
|
||||||
|
formato_distribucion = formato_distribucion+(plataforma!=null?(' '+plataforma.toUpperCase()):'')
|
||||||
|
}
|
||||||
|
if (formato_distribucion!='') formato_distribucion=' '+formato_distribucion
|
||||||
|
/**********************************/
|
||||||
|
|
||||||
|
/**** HDR ********/
|
||||||
|
def hdr_info=''
|
||||||
|
try{
|
||||||
|
def mHDRCol = ["BT.709" : "NO", "BT.2020" : "YES"]
|
||||||
|
def _HDRMap = ["HDR10": "HDR10", "SMPTE ST 2086": "HDR10", "SMPTE ST 2094 App 4": "HDR10+", "Dolby Vision / SMPTE ST 2086": "Dolby Vision", "Dolby Vision / HDR10": "Dolby Vision",]
|
||||||
|
def vid = video.first()
|
||||||
|
String _HDR
|
||||||
|
switch (bitdepth) {
|
||||||
|
case { it > 8 }:
|
||||||
|
_HDR = any
|
||||||
|
{ vid["HDR_Format_Commercial"] }
|
||||||
|
{ vid["HDR_Format"] }
|
||||||
|
{ hdr }
|
||||||
|
{ null }
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
"$bitdepth-bit"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
hdr_info = _HDRMap.find { k, v -> k =~ _HDR }?.value
|
||||||
|
if (hdr_info!=null) hdr_info=' '+hdr_info
|
||||||
|
else hdr_info=''
|
||||||
|
} catch (err) {}
|
||||||
|
/*****************/
|
||||||
|
|
||||||
|
/**** Profundidad vídeo ****/
|
||||||
|
def myBitrate = 'noBRdef'
|
||||||
|
try{ myBitrate = mbps.replace(/.0/,'').replace(' Mbps','M') }catch(err){}
|
||||||
|
def myFps = ' FRvar'
|
||||||
|
try { myFps = ' '+fps.replace(/.0/,'').replace(' fps','f') }catch(err){}
|
||||||
|
/***************************/
|
||||||
|
|
||||||
|
/* BLOQUE VIDEO */
|
||||||
|
def bloqueCalidadVideo = calidad + formato_distribucion
|
||||||
|
def bloqueDescVideo = myBitrate + myFps + hdr_info
|
||||||
|
def bloqueVideo = ' ['+codecVideo+' '+bloqueCalidadVideo+' '+bloqueDescVideo+']'
|
||||||
|
/**********************************************************************************************************/
|
|
@ -0,0 +1,10 @@
|
||||||
|
def numPaises = info.ProductionCountries.size()
|
||||||
|
def llengu = {try {def langs=[]; for (lan in languages) langs.add(lan.toString()); return langs } catch(err) {[]}}()
|
||||||
|
def tieneAnimacion = genres.any{ it =~ /Anima.i.n/}
|
||||||
|
|
||||||
|
def esAnime = false
|
||||||
|
if (tieneAnimacion && info.ProductionCountries.contains("JP") && (!llengu.isEmpty() ? llengu.contains('jpn') : true)) {
|
||||||
|
esAnime = (numPaises==1 || anime || country=="JP")
|
||||||
|
&& ["nemo"].any{!localize.English.n.toLowerCase().contains(it)}
|
||||||
|
}
|
||||||
|
esAnime
|
|
@ -0,0 +1 @@
|
||||||
|
def var1 = "/path1/" + y + "/"
|
|
@ -0,0 +1 @@
|
||||||
|
return var1 + fn + " - again"
|
Loading…
Reference in New Issue