From 5670e73e68526f5e389f7108df478f48da868725 Mon Sep 17 00:00:00 2001 From: xeviff <73612508+xeviff@users.noreply.github.com> Date: Wed, 24 May 2023 14:12:15 +0200 Subject: [PATCH] I'm starting refactor to include series --- ....groovy => Mangrana_Series_original.groovy | 0 Movies_Relocate.groovy | 12 +- Movies_Relocate_Rename.groovy | 21 +-- Movies_Rename.groovy | 19 +-- Series_Rename.groovy | 11 ++ .../classification.groovy | 95 +++-------- {split => movies}/audio.groovy | 0 {split => movies}/catch.groovy | 2 +- movies/folder_file.groovy | 58 +++++++ {split => movies}/functions.groovy | 2 +- {split => movies}/init_newMovies.groovy | 0 {split => movies}/init_relocate.groovy | 0 {split => movies}/root_folders.groovy | 8 +- {split => movies}/subs.groovy | 0 {split => movies}/validations.groovy | 4 +- {split => movies}/video.groovy | 0 old/Mangrana_Series.groovy | 153 ++++++++++++++++++ series/root_folders.groovy | 13 ++ test/spanish.groovy | 27 ++++ 19 files changed, 323 insertions(+), 102 deletions(-) rename Mangrana_Series.groovy => Mangrana_Series_original.groovy (100%) create mode 100755 Series_Rename.groovy rename split/folder_file.groovy => common/classification.groovy (57%) rename {split => movies}/audio.groovy (100%) rename {split => movies}/catch.groovy (97%) create mode 100755 movies/folder_file.groovy rename {split => movies}/functions.groovy (97%) rename {split => movies}/init_newMovies.groovy (100%) rename {split => movies}/init_relocate.groovy (100%) rename {split => movies}/root_folders.groovy (71%) rename {split => movies}/subs.groovy (100%) rename {split => movies}/validations.groovy (80%) rename {split => movies}/video.groovy (100%) create mode 100755 old/Mangrana_Series.groovy create mode 100755 series/root_folders.groovy create mode 100755 test/spanish.groovy diff --git a/Mangrana_Series.groovy b/Mangrana_Series_original.groovy similarity index 100% rename from Mangrana_Series.groovy rename to Mangrana_Series_original.groovy diff --git a/Movies_Relocate.groovy b/Movies_Relocate.groovy index dac967a..2f419bb 100755 --- a/Movies_Relocate.groovy +++ b/Movies_Relocate.groovy @@ -1,8 +1,10 @@ { def only_relocate=true -@split/init_relocate.groovy -@split/root_folders.groovy -@split/folder_file.groovy -@split/catch.groovy -@split/functions.groovy +//def relocationFrom="Pelis_familiar/" +@movies/init_relocate.groovy +@common/classification.groovy +@movies/root_folders.groovy +@movies/folder_file.groovy +@movies/catch.groovy +@movies/functions.groovy } \ No newline at end of file diff --git a/Movies_Relocate_Rename.groovy b/Movies_Relocate_Rename.groovy index 764eee6..49af786 100755 --- a/Movies_Relocate_Rename.groovy +++ b/Movies_Relocate_Rename.groovy @@ -1,12 +1,13 @@ { -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 +def relocationFrom="Pelis_estrenos/" +@movies/init_relocate.groovy +@movies/root_folders.groovy +@movies/validations.groovy +@movies/video.groovy +@movies/audio.groovy +@movies/subs.groovy +@common/classification.groovy +@movies/folder_file.groovy +@movies/catch.groovy +@movies/functions.groovy } \ No newline at end of file diff --git a/Movies_Rename.groovy b/Movies_Rename.groovy index 567a1ff..5ec63fd 100755 --- a/Movies_Rename.groovy +++ b/Movies_Rename.groovy @@ -1,11 +1,12 @@ { -@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 +@movies/init_newMovies.groovy +@movies/root_folders.groovy +@movies/validations.groovy +@movies/video.groovy +@movies/audio.groovy +@movies/subs.groovy +@common/classification.groovy +@movies/folder_file.groovy +@movies/catch.groovy +@movies/functions.groovy } \ No newline at end of file diff --git a/Series_Rename.groovy b/Series_Rename.groovy new file mode 100755 index 0000000..d08cd60 --- /dev/null +++ b/Series_Rename.groovy @@ -0,0 +1,11 @@ +{ +def relocation=false +@series/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 +} \ No newline at end of file diff --git a/split/folder_file.groovy b/common/classification.groovy similarity index 57% rename from split/folder_file.groovy rename to common/classification.groovy index d80c1f8..eb8f611 100755 --- a/split/folder_file.groovy +++ b/common/classification.groovy @@ -10,9 +10,11 @@ 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) {[]}}() +def soloLangIngles = llengu.size()==1 && llengu[0]=="eng" //animacion (no concluyente) -def tieneAnimacion = genres.any{ it =~ /Anima.i.n/} +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 @@ -31,14 +33,16 @@ 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 (tieneFamiliar && tieneAnimacion) { - def noTanInfantil = certifications.US ==~/PG-13/ && certifications.ES!="7" - if (!noTanInfantil) infantil = true - } + if (detectadoNoInfantil) infantil=false + else if (tieneFamiliar && tieneAnimacion) infantil=true else if (tieneAnimacion) { if (tieneCertificacion) { - infantil = certifications.US=="G" + infantil = (certifications.US!=null ? certifications.US!="R" : true) && + (certifications.US=="G" || certifications.ES==~/Ai|APTA/ || certifications.DE==~/0/ || certifications.IT=="T" @@ -46,7 +50,7 @@ if (!tipoYaSeteado) { || certifications.LT=="V" || certifications.RU ==~ /6.+/ || certifications.BR=="L" || certifications.NO=="A" - || certifications.FR=="U" + || certifications.FR=="U") } else { def titulosInfantiles = ['boonie bears', 'the jungle bunch'] if (titulosInfantiles.any { localize.English.n.toLowerCase().contains(it) }) @@ -69,24 +73,24 @@ 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)) - +if (!tipoYaSeteado && (numPaises>0 ? prodCountries.contains("ES") : true)) { catalana = llengu.contains('cat') - + if (!catalana) { + 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") || (llengu.size()==2 && llengu.contains("spa"))) + || (movie.alternativeTitles.size()==1 && movie.alternativeTitles.ES!=null) + || (pais=="ES" && (!llengu.isEmpty() ? llengu.size()==1 && llengu[0]=="spa" : true)) + } tipoYaSeteado = tipoYaSeteado || espanyola || catalana } //asiaticas def asiatica = false -if (!tipoYaSeteado) { +if (!tipoYaSeteado && !soloLangIngles) { 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"] @@ -104,58 +108,9 @@ if (!tipoYaSeteado) { //*** latina *** def latina = false -if (!tipoYaSeteado) { +if (!tipoYaSeteado && !soloLangIngles) { 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/} + || info.ProductionCompanies.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 -/////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/split/audio.groovy b/movies/audio.groovy similarity index 100% rename from split/audio.groovy rename to movies/audio.groovy diff --git a/split/catch.groovy b/movies/catch.groovy similarity index 97% rename from split/catch.groovy rename to movies/catch.groovy index ebf35f9..dff972a 100755 --- a/split/catch.groovy +++ b/movies/catch.groovy @@ -34,7 +34,7 @@ } } - def resultado = rutaKO + rutaMotivoErr + msgErr + '/' + localize.English.plex.name + '/' + fn + def resultado = rutaKO + rutaMotivoErr + msgErr + '/' + localize.Spanish.plex.name + '/' + fn return resultado } diff --git a/movies/folder_file.groovy b/movies/folder_file.groovy new file mode 100755 index 0000000..44fc72c --- /dev/null +++ b/movies/folder_file.groovy @@ -0,0 +1,58 @@ +////////////////////////////////////////////// + //tria +if (esDocu) ruta = ruta_docu + "main/" +else if (esAnime) ruta = ruta_anime + "main/" +else if (infantil) ruta = ruta_infantil + "main/" +else if (esAnimacion) ruta = ruta_animacion + "main/" +else if (catalana) ruta = ruta_cat + "main/" +else if (espanyola) { + ruta = ruta_esp + if (y>2000) ruta += "sXXI/" + else ruta += "sXX/" +} else if (latina) ruta = ruta_latina + "main/" +else if (asiatica) ruta = ruta_asiaticas + "main/" +else if (esFamiliar && y>1970) ruta = ruta_familiar + "main/" +else if (y<1980) { + ruta = ruta_classic + if (y>1970) ruta += "70s/" + else ruta += "old/" +} else if (y<2000) { + ruta = ruta_retro + if (y>=1990) ruta += "90s/" + else ruta += "80s/" +} +if (ruta==ruta2000) { + if (y>=2021) ruta = ruta_estrenos + "20s/" + 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 +/////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/split/functions.groovy b/movies/functions.groovy similarity index 97% rename from split/functions.groovy rename to movies/functions.groovy index 210faa6..36b7bbe 100755 --- a/split/functions.groovy +++ b/movies/functions.groovy @@ -33,7 +33,7 @@ def printAudio (audio2Print) { } 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') + def canales = audio2Print.Channels.replace(2:'2.0', 3:'2.1', 6:'5.1', 7:'6.1', 8:'7.1') return fCom + ' ' + canales } def getBestChannelFromList (audiosFormatFound) { diff --git a/split/init_newMovies.groovy b/movies/init_newMovies.groovy similarity index 100% rename from split/init_newMovies.groovy rename to movies/init_newMovies.groovy diff --git a/split/init_relocate.groovy b/movies/init_relocate.groovy similarity index 100% rename from split/init_relocate.groovy rename to movies/init_relocate.groovy diff --git a/split/root_folders.groovy b/movies/root_folders.groovy similarity index 71% rename from split/root_folders.groovy rename to movies/root_folders.groovy index 13aeebb..46a7b1b 100755 --- a/split/root_folders.groovy +++ b/movies/root_folders.groovy @@ -2,16 +2,16 @@ def root = '/pelis/' def ruta2000 = root+"Pelis/" def ruta = ruta2000 -def ruta_docu = root+"Documentales/plain/" +def ruta_docu = root+"Documentales/" 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_esp = root+"Pelis_esp/" 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_retro = root+"Pelis_retro/" +def ruta_estrenos = root+"Pelis_estrenos/" def ruta_classic = root+"Pelis_classic/" def ruta_asiaticas = root+"Pelis_asiaticas/" def rutaKO = root+"error/" diff --git a/split/subs.groovy b/movies/subs.groovy similarity index 100% rename from split/subs.groovy rename to movies/subs.groovy diff --git a/split/validations.groovy b/movies/validations.groovy similarity index 80% rename from split/validations.groovy rename to movies/validations.groovy index 7210803..b980452 100755 --- a/split/validations.groovy +++ b/movies/validations.groovy @@ -23,10 +23,10 @@ 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 +if (vf ==~ '2160.' || (es1080 && es1080Remux)) return root+"to_transcode/" + localize.Spanish.plex.name + '/' + fn /* SANITY CHECK */ if (relocation && !sanityCheck(tmdbid)) - return root + relocationFrom + "to_check_name/" + return root + relocationFrom + "to_check_name/" + localize.Spanish.plex.name + '/' + fn //return '@@@@@@ Names Sanity Check KO @@@@@@@ --> New name: '+localize.Spanish.n+' with tmdb='+tmdbid /********************************/ diff --git a/split/video.groovy b/movies/video.groovy similarity index 100% rename from split/video.groovy rename to movies/video.groovy diff --git a/old/Mangrana_Series.groovy b/old/Mangrana_Series.groovy new file mode 100755 index 0000000..f3884c5 --- /dev/null +++ b/old/Mangrana_Series.groovy @@ -0,0 +1,153 @@ + +def server=true +def root = '/series/' +def rutaSeries = root+'NSeries/' +def ruta_docu = root+'Series_docu/' +def ruta_animacion = root+'Series_animacion/' +def ruta_anime = root+'Series_anime/' +def ruta_antiguas = root+'Series_antiguas/' +def ruta_esp = root+'Series_esp' +def ruta_teen = root+'Series_familiar' +def ruta_infantil = root+'Series_infantil' +def ruta_programastv = root+'programas_tv' + +def rutaKO = root+'error/' +def ruta = rutaSeries + + +/* otras funciones */ +def tieneGeneroAnimacion (generos) { + for (genero in generos) { + if (genero =~ /Anima[c|t]i\p{L}n/) + return true + } + return false +} +def tieneGeneroAnime (generos) { + for (genero in generos) { + if (genero =~ /Anime/) + 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 normalitzarText(txt) { + return txt.replaceAll(':','.').replaceAll('\\?','¿').replaceAll('\\"','-') +} +/**/ + + +try { //empieza el script + + try{ + media + } catch (err) {throw new Exception("[no_media]")} + + + /**************************************/ + /**** Carpeta / tipo contenido *******/ + def generes + def errorNoGenero=false + try {generes=genres} catch (err) {errorNoGenero=true} + def certificacio + try {certificacio=certification} catch (err) {} + def esDocu = tieneGeneroDocumental(generes) + def esAnime = anime || tieneGeneroAnime(generes) + def esAnimacion = tieneGeneroAnimacion(generes) + def esTeen = tieneGeneroFamilia(generes) && (certificacio==null || certificacio =~ /TV-14|TV-P?G/) + //return certificacio + " - " + generes + " - so: " + esTeen + def esInfantil = esAnimacion && certificacio =~ /TV-Y|TV-Y7|TV-P?G/ + def esReality = tieneGeneroReality(generes) + //esp? + def esEsp=false + def spanishNetwork + try{ spanishNetwork = info.Network.find(/(?i)\bTVE\b|\bmovistar\b|\bAtresmedia\b|\bcanal 9\b|\bPlayz\b|\bATRES\b|\bETB1\b|\bTV3\b|\btelecinco\b|\bcanal+\b|\bgalicia\b|\bfox españa\b|\blasexta\b|\bantena 3\b/ )} catch(e){} + if (spanishNetwork!=null || Country=='esp') esEsp=true + //tria + /*if (tenimCat) ruta = ruta_cat + else */if (esDocu) ruta = ruta_docu + else if (esReality) ruta = ruta_programastv + else if (esAnime) ruta = ruta_anime + else if (esInfantil) ruta = ruta_infantil + else if (esAnimacion) ruta = ruta_animacion + else if (esEsp) ruta = ruta_esp + else if (y < 1990) ruta = ruta_antiguas + else if (esTeen) ruta = ruta_teen + /****************************************/ + /****************************************/ + + /****************************/ + /**** Nombre de fichero *******/ + def cuaTvdb = " {tvdb-"+id+"}" + def nombreSerie = '/' + normalitzarText(localize.English.ny) + cuaTvdb + '/' + def temporada = episode.special ? + 'Specials'+'/' : + 'Temporada '+ s.pad(2) + '/' + + /****************************/ + /**** RUTA FINAL *******/ + + def resultado = ruta + nombreSerie + temporada + fn + return resultado + + +} catch (err) { + + /* + String str= err.getStackTrace().toString() + def pattern = ( str =~ /groovy.(\d+)./ ) + return " Error at line number = " + pattern[0][1] + */ + + def rutaMotivoErr + def msgErr = err.getMessage() + if (msgErr=="[formato_fichero_noestarndar]" || msgErr=="[video_roto]" || msgErr=="[no_media]") + rutaMotivoErr="/fichero/" + else if (msgErr=="[genero_no_especificado]" || msgErr=="[certificado_edad_no_especificado]") { + rutaMotivoErr="/themoviedb/" + } else if (msgErr.startsWith("[idioma_audio")) { + rutaMotivoErr="/audio/" + } else if (msgErr.startsWith("[bitrate_demasiado_alto]")) { + rutaMotivoErr="/bitrate/" + } else { + def errSplitted = msgErr.split("\\-") + if (errSplitted==null) { + rutaMotivoErr="/error_desconocido/" + } else { + return msgErr + def errType = errSplitted[0] + if (errType=="[formato_audio_no_encontrado") + rutaMotivoErr="/audio/" + else if (errType.startsWith("[idioma_audio")) + rutaMotivoErr="/idioma/" + else { + rutaMotivoErr="/error_desconocido/" + msgErr = "[error_inesperado]" + } + } + } + + def resultado = rutaKO + rutaMotivoErr + msgErr + '/' + fn + + return resultado +} \ No newline at end of file diff --git a/series/root_folders.groovy b/series/root_folders.groovy new file mode 100755 index 0000000..7ec09db --- /dev/null +++ b/series/root_folders.groovy @@ -0,0 +1,13 @@ +def root = '/series/' +def rutaSeries = root+'NSeries/' +def ruta_docu = root+'Series_docu/' +def ruta_animacion = root+'Series_animacion/' +def ruta_anime = root+'Series_anime/' +def ruta_antiguas = root+'Series_antiguas/' +def ruta_esp = root+'Series_esp' +def ruta_teen = root+'Series_familiar' +def ruta_infantil = root+'Series_infantil' +def ruta_programastv = root+'programas_tv' + +def rutaKO = root+'error/' +def ruta = rutaSeries \ No newline at end of file diff --git a/test/spanish.groovy b/test/spanish.groovy new file mode 100755 index 0000000..ce3e5eb --- /dev/null +++ b/test/spanish.groovy @@ -0,0 +1,27 @@ +def prodCountries=info.ProductionCountries +def numPaises = prodCountries.size() +def llengu = {try {def langs=[]; for (lan in languages) langs.add(lan.toString()); return langs } catch(err) {[]}}() +def certifications=info.Certifications +def pais = {try{country} catch (err) {null}}() + + +def catalana = false +def espanyola = false +if (numPaises>0 ? prodCountries.contains("ES") : true) { + catalana = llengu.contains('cat') + if (!catalana) { + 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)) + } +} + + +res =espanyola + +return res \ No newline at end of file