From f32161c47add196105671a61f63b3fa5a444ec2c Mon Sep 17 00:00:00 2001 From: xeviff <73612508+xeviff@users.noreply.github.com> Date: Fri, 9 Jun 2023 16:44:31 +0200 Subject: [PATCH] 1000 canvis --- Mangrana_Series_original.groovy | 153 ------------------ Movies_Relocate.groovy | 6 +- Movies_Relocate_Rename.groovy | 14 +- Movies_Rename.groovy | 12 +- Series_Rename.groovy | 15 +- {movies => common}/audio.groovy | 0 common/catch.groovy | 28 ++++ common/classification.groovy | 96 ++++++----- {movies => common}/functions.groovy | 3 + {movies => common}/subs.groovy | 0 {movies => common}/validations.groovy | 0 {movies => common}/video.groovy | 0 filter/isNotLatina.groovy | 4 + filter/isSpanish.groovy | 30 ++++ filter_latin.groovy | 7 - movies/catch.groovy | 40 ----- movies/folder_file.groovy | 7 +- .../Mangrana_Series_rename.groovy | 0 series/folder_file.groovy | 51 ++++++ series/root_folders.groovy | 15 +- test/isLatin.groovy | 1 + test/isSpanish.groovy | 26 +++ test/spanish.groovy | 30 +--- 23 files changed, 247 insertions(+), 291 deletions(-) delete mode 100755 Mangrana_Series_original.groovy rename {movies => common}/audio.groovy (100%) create mode 100755 common/catch.groovy rename {movies => common}/functions.groovy (96%) rename {movies => common}/subs.groovy (100%) rename {movies => common}/validations.groovy (100%) rename {movies => common}/video.groovy (100%) create mode 100755 filter/isNotLatina.groovy create mode 100755 filter/isSpanish.groovy delete mode 100755 filter_latin.groovy delete mode 100755 movies/catch.groovy rename Mangrana_Series_rename.groovy => old/Mangrana_Series_rename.groovy (100%) create mode 100755 series/folder_file.groovy create mode 100755 test/isLatin.groovy create mode 100755 test/isSpanish.groovy diff --git a/Mangrana_Series_original.groovy b/Mangrana_Series_original.groovy deleted file mode 100755 index f3884c5..0000000 --- a/Mangrana_Series_original.groovy +++ /dev/null @@ -1,153 +0,0 @@ - -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/Movies_Relocate.groovy b/Movies_Relocate.groovy index 2f419bb..61b211e 100755 --- a/Movies_Relocate.groovy +++ b/Movies_Relocate.groovy @@ -1,10 +1,10 @@ { def only_relocate=true -//def relocationFrom="Pelis_familiar/" +//def relocationFrom="Pelis_esp/" @movies/init_relocate.groovy @common/classification.groovy @movies/root_folders.groovy @movies/folder_file.groovy -@movies/catch.groovy -@movies/functions.groovy +@common/catch.groovy +@common/functions.groovy } \ No newline at end of file diff --git a/Movies_Relocate_Rename.groovy b/Movies_Relocate_Rename.groovy index 49af786..77cb9ad 100755 --- a/Movies_Relocate_Rename.groovy +++ b/Movies_Relocate_Rename.groovy @@ -1,13 +1,13 @@ { -def relocationFrom="Pelis_estrenos/" +def relocationFrom="Pelis/" @movies/init_relocate.groovy @movies/root_folders.groovy -@movies/validations.groovy -@movies/video.groovy -@movies/audio.groovy -@movies/subs.groovy +@common/validations.groovy +@common/video.groovy +@common/audio.groovy +@common/subs.groovy @common/classification.groovy @movies/folder_file.groovy -@movies/catch.groovy -@movies/functions.groovy +@common/catch.groovy +@common/functions.groovy } \ No newline at end of file diff --git a/Movies_Rename.groovy b/Movies_Rename.groovy index 5ec63fd..468a37e 100755 --- a/Movies_Rename.groovy +++ b/Movies_Rename.groovy @@ -1,12 +1,12 @@ { @movies/init_newMovies.groovy @movies/root_folders.groovy -@movies/validations.groovy -@movies/video.groovy -@movies/audio.groovy -@movies/subs.groovy +@common/validations.groovy +@common/video.groovy +@common/audio.groovy +@common/subs.groovy @common/classification.groovy @movies/folder_file.groovy -@movies/catch.groovy -@movies/functions.groovy +@common/catch.groovy +@common/functions.groovy } \ No newline at end of file diff --git a/Series_Rename.groovy b/Series_Rename.groovy index d08cd60..3525026 100755 --- a/Series_Rename.groovy +++ b/Series_Rename.groovy @@ -1,11 +1,12 @@ { 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 +@common/validations.groovy +@common/video.groovy +@common/audio.groovy +@common/subs.groovy +@common/classification.groovy +@series/folder_file.groovy +@common/catch.groovy +@common/functions.groovy } \ No newline at end of file diff --git a/movies/audio.groovy b/common/audio.groovy similarity index 100% rename from movies/audio.groovy rename to common/audio.groovy diff --git a/common/catch.groovy b/common/catch.groovy new file mode 100755 index 0000000..fd95a84 --- /dev/null +++ b/common/catch.groovy @@ -0,0 +1,28 @@ +} 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]" || msgErr=="[no_id]") { + rutaMotivoErr="/idb/" + } else if (msgErr.startsWith("[idioma_audio")) { + rutaMotivoErr="/audio/" + } else { + //rutaMotivoErr="/others/" + //msgErr='' + rutaMotivoErr=msgErr + } + + def resultado = rutaKO + rutaMotivoErr + msgErr + '/' + ny + '/' + fn + + return resultado +} diff --git a/common/classification.groovy b/common/classification.groovy index eb8f611..8e505a9 100755 --- a/common/classification.groovy +++ b/common/classification.groovy @@ -4,13 +4,15 @@ //inits def tipoYaSeteado=false -def prodCountries=info.ProductionCountries -def certifications=info.Certifications +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 soloLangIngles = llengu.size()==1 && llengu[0]=="eng" +def llenguaOriginal = {try{info.OriginalLanguage} catch(e){null}}() //animacion (no concluyente) def fakeAnimacionList = ["blue & malone", "cool world"] @@ -67,50 +69,72 @@ if (!tipoYaSeteado) { } //animacion -def esAnimacion = tieneAnimacion && !infantil -tipoYaSeteado = tipoYaSeteado || esAnimacion +def esAnimacion = tieneAnimacion && !infantil && !["brexitazo","dibujos maléficos"].any{localize.Spanish.n.toLowerCase().contains(it)} -//*** española / catalana *** -def catalana = false -def espanyola = false -if (!tipoYaSeteado && (numPaises>0 ? prodCountries.contains("ES") : true)) { - catalana = llengu.contains('cat') - if (!catalana) { +//catalana +def catalana = llenguaOriginal=='ca' //|| (llengu.contains('cat') && llengu.size()<4) + +//hispana +def espanyola = llenguaOriginal=='gl' || llenguaOriginal=='eu' + +/** español **/ +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" && !soloLangIngles) { + // latina *** + def latinWhitelist = {try{info.ProductionCompanies.any{it=~/Corazón Films/}} catch(e){false} }() + || {try{["Kenya Marquez"].any{director==it}}catch(err){false}}() + def latinBlacklist = ["nightmare radio"].any{ localize.Spanish.n.toLowerCase().contains(it) } + + if (latinWhitelist) { + latina = true + } else if (latinBlacklist || ({ 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}}())) + /*en seguiment*/|| numPaises == 0) { + //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 + if (isActuallySpanish) latina = false + } + } + if (!latina) espanyola = true + + // española *** + /*if (!tipoYaSeteado && (numPaises>0 ? prodCountries.contains("ES") : true)) { 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)) + (numPaises==1 || (numPaises==2 && prodCountries.contains("ES") && prodCountries.any{ it=~/AR|PT/ })) + || { 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}}() && llengu.contains("spa") && (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)) + || {try{ movie.alternativeTitles.size()==1 && movie.alternativeTitles.ES!=null} catch(e){false}}() + || (pais=~/ES|esp/ && (!llengu.isEmpty() ? llengu.size()==1 && llengu[0]=="spa" : true)) } - tipoYaSeteado = tipoYaSeteado || espanyola || catalana + if (!espanyola) latina = true*/ + + tipoYaSeteado = tipoYaSeteado || espanyola || latina } //asiaticas def asiatica = false if (!tipoYaSeteado && !soloLangIngles) { - def paisesAsiaticos = ["CN", "HK", "JP", "KP", "KR", "TH", "NP", "TW", "PH", "MO", "SU"] + //nn def paisesAsiaticos = ["CN", "HK", "JP", "KP", "KR", "TH", "NP", "TW", "PH", "MO"] 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) - + def languajAsia = ["zh", "cn", "ko", "th", "vi", "ja", "id", "hi", "tl"] + //nn def machingLanguages = languajAsia.intersect(llengu).size() + asiatica = languajAsia.contains(llenguaOriginal) + //|| paisesAsiaticos.any{ pais==it } //dona falsos positius + //nn || (numPaises != 0 && {((paisesIntersec=paisesAsiaticos.intersect(prodCountries).size()) == numPaises || (/*en observacion*/paisesIntersec!=0 && !llengu.contains('eng')) ) }()) + //nn || (languajAsia.any{audioLlengu.contains(it)} && prodCountries.any{paisesAsiaticos.contains(it)} && llengu.any{languajAsia.contains(it)} ) + //nn || {try {director.contains("Takeshi Kitano")} catch (e) {false}}() + //|| (machingLanguages > 0 && primaryTitle!=null && localize.English.n!=primaryTitle) // titols en francès diu que es asiatica + //*nn: No Necessari (ja que amb l'idioma original crec que ja esta) tipoYaSeteado = tipoYaSeteado || asiatica } - - -//*** latina *** -def latina = false -if (!tipoYaSeteado && !soloLangIngles) { - def paisesLatinos = ["MX", "AR"] - latina = {try {paisesLatinos.contains(pais)} catch (e) {false}}() - || (numPaises != 0 && paisesLatinos.intersect(prodCountries).size() == numPaises) - || info.ProductionCompanies.any{it=~/Corazón Films/} -} diff --git a/movies/functions.groovy b/common/functions.groovy similarity index 96% rename from movies/functions.groovy rename to common/functions.groovy index 36b7bbe..62142e0 100755 --- a/movies/functions.groovy +++ b/common/functions.groovy @@ -84,4 +84,7 @@ def sanityCheck(newId) { def oldId = fn.find(/\{tmdb-\d+\}/)?.find(/\d+/) return oldId!=null ? oldId == newId.toString() : true } +def normalitzarText(txt) { + return txt.replaceAll(':','.').replaceAll('\\?','¿').replaceAll('\\"','-') +} /***********/ diff --git a/movies/subs.groovy b/common/subs.groovy similarity index 100% rename from movies/subs.groovy rename to common/subs.groovy diff --git a/movies/validations.groovy b/common/validations.groovy similarity index 100% rename from movies/validations.groovy rename to common/validations.groovy diff --git a/movies/video.groovy b/common/video.groovy similarity index 100% rename from movies/video.groovy rename to common/video.groovy diff --git a/filter/isNotLatina.groovy b/filter/isNotLatina.groovy new file mode 100755 index 0000000..c084a4e --- /dev/null +++ b/filter/isNotLatina.groovy @@ -0,0 +1,4 @@ +@../common/classification.groovy +def isLatina = !esDocu && !esAnime && !infantil && !esAnimacion && !catalana && !espanyola + && latina +return !isLatina \ No newline at end of file diff --git a/filter/isSpanish.groovy b/filter/isSpanish.groovy new file mode 100755 index 0000000..24d3d20 --- /dev/null +++ b/filter/isSpanish.groovy @@ -0,0 +1,30 @@ +{ +def llenguaOriginal = {try{info.OriginalLanguage} catch(e){null}}() +def prodCountries= {try{info.ProductionCountries} catch(e){[]}}() +def numPaises = prodCountries.size() +def certifications={try{info.Certifications} catch(e){[]}}() +def llengu = {try {def langs=[]; for (lan in languages) langs.add(lan.toString()); return langs } catch(err) {[]}}() + +def catalana = llenguaOriginal=='ca' || llengu.contains('cat') +def espanyola = llenguaOriginal=='gl' || llenguaOriginal=='eu' + +if (!espanyola && !catalana && llenguaOriginal=="es") { + latina = {try{info.ProductionCompanies.any{it=~/Corazón Films/}} catch(e){false} }() + || {try{["Kenya Marquez"].any{director==it}}catch(err){false}}() + + if (latina) return false + + if (numPaises>0 ? prodCountries.contains("ES") : true) { + espanyola = + (numPaises==1 || (numPaises==2 && prodCountries.contains("ES") && prodCountries.any{ it=~/AR|PT/ })) + || { 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}}() && llengu.contains("spa") && (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"))) + || {try{ movie.alternativeTitles.size()==1 && movie.alternativeTitles.ES!=null} catch(e){false}}() + || (pais=~/ES|esp/ && (!llengu.isEmpty() ? llengu.size()==1 && llengu[0]=="spa" : true)) + } +} + +return espanyola +} \ No newline at end of file diff --git a/filter_latin.groovy b/filter_latin.groovy deleted file mode 100755 index fb57bc5..0000000 --- a/filter_latin.groovy +++ /dev/null @@ -1,7 +0,0 @@ -def countries = info.ProductionCountries -def numPaises = countries.size() -def paisesLatinos = ["MX", "AR"] -def latina = (numPaises != 0 && paisesLatinos.intersect(countries).size() == numPaises) - || {try {paisesLatinos.contains(country)} catch (e) {false}}() - || info.productionCompanies.any{it=~/Corazón Films/} -return latina \ No newline at end of file diff --git a/movies/catch.groovy b/movies/catch.groovy deleted file mode 100755 index dff972a..0000000 --- a/movies/catch.groovy +++ /dev/null @@ -1,40 +0,0 @@ -} 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.Spanish.plex.name + '/' + fn - - return resultado -} diff --git a/movies/folder_file.groovy b/movies/folder_file.groovy index 44fc72c..d33d71d 100755 --- a/movies/folder_file.groovy +++ b/movies/folder_file.groovy @@ -7,11 +7,12 @@ 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/" + if (notSure) ruta += "to_observe/" + else 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 (esFamiliar && y>1960) ruta = ruta_familiar + "main/" else if (y<1980) { ruta = ruta_classic if (y>1970) ruta += "70s/" @@ -48,7 +49,7 @@ if ({try {only_relocate} catch (err) {false}}()) { } 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 trackerCatch = fn.find(/(?i)\bHD.?O(limpo)?\b|\bRedBits\b/) def tracker = trackerCatch != null ? '['+trackerCatch.replace("HDOlimpo", "HDO")+']' : '' file = nomPrincipal + tracker + tmdb diff --git a/Mangrana_Series_rename.groovy b/old/Mangrana_Series_rename.groovy similarity index 100% rename from Mangrana_Series_rename.groovy rename to old/Mangrana_Series_rename.groovy diff --git a/series/folder_file.groovy b/series/folder_file.groovy new file mode 100755 index 0000000..846c45f --- /dev/null +++ b/series/folder_file.groovy @@ -0,0 +1,51 @@ +//propi de series +def esReality = genres.any{ it =~ /Reality/ } +def tieneGAnime = genres.any{ it =~ /Anime/ } +if (!esAnime && tieneGAnime) esAnime = true +def certificacio = {try {certification} catch (err){null}}() +def esTeen = tieneFamiliar && (certificacio==null || certificacio =~ /TV-14|TV-P?G/) + +//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 (infantil) ruta = ruta_infantil +else if (esAnimacion) ruta = ruta_animacion +else if (espanyola) ruta = ruta_esp +else if (catalana) ruta = ruta_cat +else if (latina) ruta = ruta_latina +else if (y < 2000) ruta = ruta_antiguas +else if (esTeen) ruta = ruta_teen +/****************************************/ +/****************************************/ + + + +/*****************************/ +/**** carpetas previas *******/ +def inicial = ruta==rutaSeries ? getInicial()+'/' : '' +def nombreSerieEng = normalitzarText(localize.English.ny) +def cuaTvdb = "{tvdb-"+tvdb+"}" +def pathNombreSerie = '/'+nombreSerieEng+' '+cuaTvdb + '/' + +def temporada = episode.special ? + 'Specials'+'/' : + 'Temporada '+ s.pad(2) + '/' + +/****************************/ +/**** Nombre de fichero *****/ +def nombreSerie = normalitzarText({try { catalana ? localize.Catalan.ny : localize.Spanish.ny } catch (err) {localize.Spanish.ny} }()) +def tituloCapitulo = {try { catalana ? localize.Catalan.t : localize.Spanish.t } catch (err) {localize.Spanish.t} }() + +def nombreArchivo = nombreSerie+' - '+s00e00+' - '+tituloCapitulo + +def trackerCatch = fn.find(/(?i)\bHDO(limpo)?\b|\bRedBits\b/) +def tracker = trackerCatch != null ? '['+trackerCatch.replace("HDOlimpo", "HDO")+']' : '' + +/*************************/ +/**** RUTA FINAL *******/ + +def archivo = nombreArchivo + bloqueVideo + bloqueAudio + bloqueSubs + tracker +def resultado = ruta + inicial + pathNombreSerie + temporada + archivo +return resultado \ No newline at end of file diff --git a/series/root_folders.groovy b/series/root_folders.groovy index 7ec09db..cf3df43 100755 --- a/series/root_folders.groovy +++ b/series/root_folders.groovy @@ -1,13 +1,24 @@ def root = '/series/' -def rutaSeries = root+'NSeries/' +def rutaSeries = root+'Series/' +def rutaNSeries = 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_cat = root+'Series_cat' +def ruta_latina = root+'Series_lat' 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 +def ruta = rutaNSeries + +try { + def tvdb = series.getExternalId('TheTVDB') + if (tvdb==null) throw new Exception("[no_id]") + + if (f.toString().contains("/"+rutaSeries)) { + ruta = rutaSeries + } \ No newline at end of file diff --git a/test/isLatin.groovy b/test/isLatin.groovy new file mode 100755 index 0000000..1c8564a --- /dev/null +++ b/test/isLatin.groovy @@ -0,0 +1 @@ +language: {info.OriginalLanguage}, spoken: {info.SpokenLanguages}, countries: {info.ProductionCountries}, lat: {["MX", "AR", "CO", "BR", "CL", "PE", "CU", "VE", "UY"].intersect(info.ProductionCountries).size()>0} \ No newline at end of file diff --git a/test/isSpanish.groovy b/test/isSpanish.groovy new file mode 100755 index 0000000..31fc8e2 --- /dev/null +++ b/test/isSpanish.groovy @@ -0,0 +1,26 @@ +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}}() + || (certifications.size()==1 && certifications.ES!=null) + || (llengu.size()==1 && llengu[0]=="spa") + || (movie.alternativeTitles.size()==1 && movie.alternativeTitles.ES!=null) + } +} + + +res =espanyola + +return res \ No newline at end of file diff --git a/test/spanish.groovy b/test/spanish.groovy index ce3e5eb..8061a28 100755 --- a/test/spanish.groovy +++ b/test/spanish.groovy @@ -1,27 +1,3 @@ -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 +language: {info.OriginalLanguage}, lat_country: {["MX", "AR", "CO", "BR", "CL", "PE", "CU", "VE", "UY"].intersect(info.ProductionCountries).size()>0}, spoken: {info.SpokenLanguages}, countries: {info.ProductionCountries}, +spanish_aff: {{ 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))} \ No newline at end of file