From 356a5178fa848313dc09f5ddafdcdaa5f133e10c Mon Sep 17 00:00:00 2001 From: Xavier Fontanet Date: Tue, 18 Jul 2023 13:45:49 +0200 Subject: [PATCH] isSerie, new rootFolders --- Movies_Rename_Hardlink.groovy | 13 +++++++++++ Series_Rename_Hardlink.groovy | 13 +++++++++++ common/classification.groovy | 8 +++---- common/validations.groovy | 5 ++++- movies/folder_file.groovy | 26 +++++++++++----------- movies/root_folders.groovy | 26 +++++++++++----------- series/folder_file.groovy | 4 +++- series/root_folders.groovy | 42 +++++++++++++---------------------- 8 files changed, 78 insertions(+), 59 deletions(-) create mode 100644 Movies_Rename_Hardlink.groovy create mode 100644 Series_Rename_Hardlink.groovy diff --git a/Movies_Rename_Hardlink.groovy b/Movies_Rename_Hardlink.groovy new file mode 100644 index 0000000..1eee602 --- /dev/null +++ b/Movies_Rename_Hardlink.groovy @@ -0,0 +1,13 @@ +{ +def hardlink=true +@movies/init_newMovies.groovy +@movies/root_folders.groovy +@common/validations.groovy +@common/video.groovy +@common/audio.groovy +@common/subs.groovy +@common/classification.groovy +@movies/folder_file.groovy +@common/catch.groovy +@common/functions.groovy +} \ No newline at end of file diff --git a/Series_Rename_Hardlink.groovy b/Series_Rename_Hardlink.groovy new file mode 100644 index 0000000..4855c89 --- /dev/null +++ b/Series_Rename_Hardlink.groovy @@ -0,0 +1,13 @@ +{ +def hardlink=true +def relocation=false +@series/root_folders.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/common/classification.groovy b/common/classification.groovy index 99d5043..bf16360 100755 --- a/common/classification.groovy +++ b/common/classification.groovy @@ -11,7 +11,6 @@ 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) @@ -81,7 +80,7 @@ def espanyola = llenguaOriginal=='gl' || llenguaOriginal=='eu' def latina = ["che: el argentino"].any{localize.Spanish.n.toLowerCase().contains(it)} def notSure = false tipoYaSeteado == tipoYaSeteado || esAnimacion || catalana || espanyola || latina -if (!tipoYaSeteado && llenguaOriginal=~/es|spa/ && !soloLangIngles) { +if (!tipoYaSeteado && llenguaOriginal=~/es|spa/) { // latina *** def latinWhitelist = {try{info.ProductionCompanies.any{it=~/Corazón Films/}} catch(e){false} }() || {try{["Kenya Marquez"].any{director==it}}catch(err){false}}() @@ -113,9 +112,10 @@ if (!tipoYaSeteado && llenguaOriginal=~/es|spa/ && !soloLangIngles) { //asiaticas def asiatica = false -if (!tipoYaSeteado && !soloLangIngles) { +if (!tipoYaSeteado) { def paisesIntersec=0 - def languajAsia = ["zh", "cn", "ko", "th", "vi", "ja", "id", "hi", "tl", "bo"] + def languajAsia = isMovie ? ["zh", "cn", "ko", "th", "vi", "ja", "id", "hi", "tl", "bo", "te"] + : ["zho", "cn", "kor", "tha", "vie", "jpn", "ind", "hin", "tgl", "bod"] asiatica = languajAsia.contains(llenguaOriginal) tipoYaSeteado = tipoYaSeteado || asiatica } diff --git a/common/validations.groovy b/common/validations.groovy index b980452..6e14ecf 100755 --- a/common/validations.groovy +++ b/common/validations.groovy @@ -23,10 +23,13 @@ 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 root+"to_transcode/" + localize.Spanish.plex.name + '/' + 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/" + localize.Spanish.plex.name + '/' + fn //return '@@@@@@ Names Sanity Check KO @@@@@@@ --> New name: '+localize.Spanish.n+' with tmdb='+tmdbid /********************************/ + +def isMovie = {try{movie!=null} catch(e){false}}() +def isSerie = {try{series!=null} catch(e){false}}() \ No newline at end of file diff --git a/movies/folder_file.groovy b/movies/folder_file.groovy index 20421d6..0cbfa79 100755 --- a/movies/folder_file.groovy +++ b/movies/folder_file.groovy @@ -1,30 +1,30 @@ ////////////////////////////////////////////// //tria -if (esDocu) ruta = ruta_docu + "new/" -else if (esAnime) ruta = ruta_anime + "new/" -else if (infantil) ruta = ruta_infantil + "new/" -else if (esAnimacion) ruta = ruta_animacion + "new/" -else if (catalana) ruta = ruta_cat + "new/" +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 + "new/" + ruta = ruta_esp + "main/" /*if (notSure) ruta += "to_observe/" else if (y>2000) ruta += "sXXI/" else ruta += "sXX/"*/ -} else if (latina) ruta = ruta_latina + "new/" -else if (asiatica) ruta = ruta_asiaticas + "new/" -else if (esFamiliar && y>1960) ruta = ruta_familiar + "new/" +} else if (latina) ruta = ruta_latina + "main/" +else if (asiatica) ruta = ruta_asiaticas + "main/" +else if (esFamiliar && y>1960) ruta = ruta_familiar + "main/" else if (y<1980) { - ruta = ruta_classic + "new/" + ruta = ruta_classic + "main/" /*if (y>1970) ruta += "70s/" else ruta += "old/"*/ } else if (y<2000) { - ruta = ruta_retro + "new/" + ruta = ruta_retro + "main/" /*if (y>=1990) ruta += "90s/" else ruta += "80s/"*/ } if (ruta==ruta2000) { - if (y>=2021) ruta = ruta_estrenos + "new/"// + "20s/" - else ruta += "new/" + if (y>=2021) ruta = ruta_estrenos + "main/"// + "20s/" + else ruta += "main/" /*else if (y>=2010) ruta += "2010-2020/" else ruta += "2000-2010/"*/ } diff --git a/movies/root_folders.groovy b/movies/root_folders.groovy index 46a7b1b..d1861eb 100755 --- a/movies/root_folders.groovy +++ b/movies/root_folders.groovy @@ -1,19 +1,19 @@ /** RUTAS **/ -def root = '/pelis/' -def ruta2000 = root+"Pelis/" +def root = {try {hardlink} catch (err) {false}}() ? '/data/media/movies/' : '/pelis/' +def ruta2000 = root+"Pelis_2000/" def ruta = ruta2000 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/" -def ruta_latina = root+"Pelis_lat/" -def ruta_cat = root+"Pelis_cat/" -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 ruta_anime = root+"Pelis_Anime/" +def ruta_animacion = root+"Pelis_Animacio/" +def ruta_infantil = root+"Pelis_Infantil/" +def ruta_familiar = root+"Pelis_Familiar/" +def ruta_esp = root+"Pelis_Hispano/" +def ruta_latina = root+"Pelis_Latin/" +def ruta_cat = root+"Pelis_Catala/" +def ruta_retro = root+"Pelis_Retro/" +def ruta_estrenos = root+"Pelis_NewAge/" +def ruta_classic = root+"Pelis_Classic/" +def ruta_asiaticas = root+"Pelis_Asia/" def rutaKO = root+"error/" /**********/ diff --git a/series/folder_file.groovy b/series/folder_file.groovy index 21a574a..27f4de7 100755 --- a/series/folder_file.groovy +++ b/series/folder_file.groovy @@ -16,6 +16,7 @@ else if (catalana) ruta = ruta_cat else if (espanyola) ruta = ruta_esp else if (catalana) ruta = ruta_cat else if (latina) ruta = ruta_latina +else if (asiatica) ruta = ruta_asia else if (y < 2000) ruta = ruta_antiguas else if (esTeen) ruta = ruta_teen /****************************************/ @@ -25,8 +26,9 @@ else if (esTeen) ruta = ruta_teen /*****************************/ /**** carpetas previas *******/ -def inicial = ruta==rutaSeries ? getInicial()+'/' : '' +def inicial = false ? getInicial()+'/' : '' def nombreSerieEng = normalitzarText(localize.English.ny) +def tvdb = id def cuaTvdb = "{tvdb-"+tvdb+"}" def pathNombreSerie = '/'+nombreSerieEng+' '+cuaTvdb + '/' diff --git a/series/root_folders.groovy b/series/root_folders.groovy index 7d1a259..50e60fe 100755 --- a/series/root_folders.groovy +++ b/series/root_folders.groovy @@ -1,31 +1,19 @@ -def root = '/series/' +def root = {try {hardlink} catch (err) {false}}() ? '/data/media/tv/' : '/series/' -def rutaSeries = root+ 'Series/' -def rutaNSeries = root+'NSeries/' -def ruta_docu = root+'Series_docu/new/' -def ruta_animacion = root+'Series_animacion/new/' -def ruta_anime = root+'Series_anime/new/' -def ruta_antiguas = root+'Series_antiguas/new/' -def ruta_esp = root+'Series_esp/new/' -def ruta_cat = root+'Series_cat/new/' -def ruta_latina = root+'Series_lat/new/' -def ruta_teen = root+'Series_familiar/new/' -def ruta_infantil = root+'Series_infantil/new/' -def ruta_programastv = root+'programas_tv/new/' +def rutaSeries = root+ 'Series/new/' +def ruta_docu = root+'Series_Docu/main/' +def ruta_animacion = root+'Series_Animacio/main/' +def ruta_anime = root+'Series_Anime/main/' +def ruta_asia = root+'Series_Asia/main/' +def ruta_antiguas = root+'Series_Retro/main/' +def ruta_esp = root+'Series_Hispano/main/' +def ruta_cat = root+'Series_Catala/main/' +def ruta_latina = root+'Series_lat/main/' +def ruta_teen = root+'Series_familiar/main/' +def ruta_infantil = root+'Series_Infantil/main/' +def ruta_programastv = root+'programas_tv/main/' def rutaKO = root+'error/' -def ruta = rutaNSeries +def ruta = rutaSeries -try { - def tvdb = series.getExternalId('TheTVDB') - if (tvdb==null) throw new Exception("[no_id]") - - if (f.toString().contains('/Series/')) { - ruta = rutaSeries - } - - def freshFile = ct >= '2022-03-18' - - if (freshFile) { - ruta = ruta.replace('/Series/','/freshOldSeries/') - } \ No newline at end of file +try { \ No newline at end of file