From d3c89457b8b2b2293b3e9a462fb230d6009a0994 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 3 Jan 2025 14:55:47 +0000 Subject: [PATCH] Compile Groovy Scripts --- compiled/movie.groovy | 2 +- compiled/music_shared.groovy | 2 +- compiled/post_xmbcnfo.groovy | 2 +- compiled/tv.groovy | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiled/movie.groovy b/compiled/movie.groovy index a71768b..a6c1c97 100644 --- a/compiled/movie.groovy +++ b/compiled/movie.groovy @@ -1 +1 @@ -{def cC = { System.getProperty(it) };def Mpt = cC("os.name").toLowerCase().contains("windows");def dQ = cC("user.name");def cR = "/run/media/${dQ}";def KY = Mpt ? "H:/" : "$cR/Videos";def ch = [[TNy: "Books", yTk: "F:/", FO: "$cR/Books"],[TNy: "Data", yTk: "D:/", FO: "$cR/Data"],[TNy: "Games", yTk: "G:/", FO: "$cR/Games"],[TNy: "Music", yTk: "E:/", FO: "$cR/Music"],[TNy: "Videos", yTk: "H:/", FO: "$cR/Videos"]];def bJk = (ch.collect { it[Mpt ? "yTk" : "FO"] as File }.sort { Nl, ZyH -> Nl.exists() <=> ZyH.exists() ?: Nl.diskSpace <=> ZyH.diskSpace }).last();def mZ = KY ?: bJk;"$mZ/"}{"Videos/"}{def kC_ = ["boys' love (bl)", "gay theme", "yaoi", "yuri", "lesbian", "hentai","sex", "lgbt", "explicit", "adult animation", "adult content","nudity"];def YM = "TheMovieDB::TV";def OQd = [[ 74180, YM],[ 93821, YM],[ 95897, YM],[220118, YM],[271026, YM]];def yZq = [[236530, YM]];def QY = any { info.database } { id == tmdbid ? "TheMovieDB" : "IMDb" };def XaK = QY == "IMDb" ? "tt${id}" : id;def XlW = any { info.adult } { false };def Ng = OQd.find { it[0] == XaK && it[1] == QY } != null;def YKh = yZq.find { it[0] == XaK && it[1] == QY } != null;def hF = info.Keywords.findAll { it in kC_ } || Ng || XlW;hF = YKh ? false : hF;hF ? "R18+ " : ""}{def AqJ = ["CN", "JP", "KR", "KP", "TW", "HK"];def iv = ["aeni", "donghua", "anime"];def ppp = any {anime} || info.Keywords.findAll { it in iv } || (AqJ.contains(country) && genres =~ /Animation/);ppp ? "Anime Movies/" : "Movies/"}{def YM = "TheMovieDB::TV";def cde = [[zul: 68854, YJ: "From Me to You", DYw: YM],[zul: 219816, YJ: "Fate/Grand Order: Fujimaru Ritsuka Doesn't Get It", DYw: YM],[zul: 259559, YJ: "Headhunted to Another World", DYw: YM],[zul: 276204, YJ: "Bogus Skill Fruitmaster", DYw: YM]];def QY = any { info.database } { id == tmdbid ? "TheMovieDB" : "IMDb" };def XaK = QY == "IMDb" ? "tt${id}" : id;def iO = n;cde.each {if (it.zul == XaK && it.DYw == QY) {iO = it.YJ}};def wFj = ['\\', '/', ':', '*', '?', '"', '<', '>', '|'];def NUQ = iO.replaceAll(wFj.collect { "\\" + it }.join('|'), '');NUQ = NUQ.replaceAll(/(\s|\.)*$/, '');NUQ}{" ("}{y}{")"}{"/"}{def VLX = ["Alqanime","BlackLuster","Kuramanime","NanDesuKa","ToonsHub","Tsundere-Raws","Samehadaku"];def nHN = VLX.find { v_k -> fn.lower().contains(v_k.lower()) } ?: "";def klH = any {(fn =~ /^\[(.*?)\]/)[0][1]} {nHN} {group} {""};klH ? "[$klH] " : ""}{def YM = "TheMovieDB::TV";def cde = [[zul: 68854, YJ: "From Me to You", DYw: YM],[zul: 219816, YJ: "Fate/Grand Order: Fujimaru Ritsuka Doesn't Get It", DYw: YM],[zul: 259559, YJ: "Headhunted to Another World", DYw: YM],[zul: 276204, YJ: "Bogus Skill Fruitmaster", DYw: YM]];def QY = any { info.database } { id == tmdbid ? "TheMovieDB" : "IMDb" };def XaK = QY == "IMDb" ? "tt${id}" : id;def iO = n;cde.each {if (it.zul == XaK && it.DYw == QY) {iO = it.YJ}};def wFj = ['\\', '/', ':', '*', '?', '"', '<', '>', '|'];def NUQ = iO.replaceAll(wFj.collect { "\\" + it }.join('|'), '');NUQ = NUQ.replaceAll(/(\s|\.)*$/, '');NUQ}{" ("}{y}{")"}{" ["}{def fH = [["ABEMA"],["ADN"],["BBC"],["BILI", "B-Global", "BiliIntl", "B-Site", "BiliCN"],["COOLMIC"],["HIDIVE", "HIDI.WEB-DL"],["IQIYI", "IQ.WEB-DL"],["JFFP"],["LAFTEL", "LFTL"],["MDON", "MANGADON"],["MW.WEB-DL"],["NF.WEB-DL", "NF WEB"],["SHAHID"],["TVER"],["UNEXT"],["WETV"],["YT.WEB-DL", "YOUTUBE", "YTB"]];def rJr = ["ASW", "Judas", "JRx7", "EMBER", "KawaSubs", "GuodongSubs", "SAMEHADAKU"];def oL = ["Erai-raws", "SubsPlease"];def LWO = any {(fn =~ /^\[(.*?)\]/)[0][1]} {""};def sR = any {def Gc = fH.find { HJ -> HJ.find { uh -> fn.lower().contains(uh.lower()) } }[0];Gc = Gc.replace(".WEB-DL", "");def qWx = source.contains("WEB-DL");def pn = source ? ".${source}" : "";qWx ? "${Gc}.WEB-DL" : Gc ? "${Gc}${pn}" : ""} {} {source} {rJr.find { cUS -> group == cUS || LWO == cUS } ? "WEBRip" : ""} {def ql = oL.find { Ywm -> group == Ywm || LWO == Ywm} ? "WEB-DL" : "";(source == "Erai-raws" && vcf.upper() == "HEVC") ? "WEBRip" : ql} {vs} {""};sR ? "$sR " : ""}{def udy = bitdepth ? " ${bitdepth}bit" : "";"$resolution $vcf $udy, $ac"}{" "}{af.format(8: 'DD+ 7.1',7: '6.1',6: 'DD 5.1',5: '5.0',3: '2.1',2: '2.0',1: '1.0')}{def CV = " Dub";def An = audioLanguages.any { it.ISO3B == language.ISO3B } ? "" : CV;An = audioLanguages.size() == 1 && audioLanguages.any { it.ISO3B == "und" } ? "" : An;An}{def Zf = any { audioLanguages.size() } { 0 };def An = Zf > 2 ? " MAud" : Zf > 1 ? " DAud" : null;def jCD = Zf > 5 ? audioLanguages.take(5) : audioLanguages;An ? An + jCD.joining(" ", " (", "").upper() + (Zf > 5 ? " ...)" : ")") : ""}{def Gi = any { textLanguages.size() } { 0 };def An = Gi > 2 ? ", MSub" : Gi > 1 ? ", DSub" : null;def jCD = Gi > 5 ? textLanguages.take(5) : textLanguages;An ? An + jCD.joining(" ", " (", "").upper() + (Gi > 5 ? " ...)" : ")") : ""}{"]["}{crc32.upper()}{"]"}{if (f.subtitle) {def Kro = ["name": "." + lang.name,"iso3b": "." + lang.ISO3B,"iso3": "." +lang.ISO3,"iso2": "." + lang.ISO2];def hA = subt;Kro.values().each { NF -> if (hA.contains(NF)) {hA = hA.replace(NF, "")}};Kro.iso3b + hA}}{f.image ? "-thumb" : ""} \ No newline at end of file +{def OJ = { System.getProperty(it) };def yb = OJ("os.name").toLowerCase().contains("windows");def Mxt = OJ("user.name");def do = "/run/media/${Mxt}";def Ox = yb ? "H:/" : "$do/Videos";def yX = [[HpK: "Books", taF: "F:/", Zp: "$do/Books"],[HpK: "Data", taF: "D:/", Zp: "$do/Data"],[HpK: "Games", taF: "G:/", Zp: "$do/Games"],[HpK: "Music", taF: "E:/", Zp: "$do/Music"],[HpK: "Videos", taF: "H:/", Zp: "$do/Videos"]];def kHo = (yX.collect { it[yb ? "taF" : "Zp"] as File }.sort { kA, wbU -> kA.exists() <=> wbU.exists() ?: kA.diskSpace <=> wbU.diskSpace }).last();def go = Ox ?: kHo;"$go/"}{"Videos/"}{def ip = ["boys' love (bl)", "gay theme", "yaoi", "yuri", "lesbian", "hentai","sex", "lgbt", "explicit", "adult animation", "adult content","nudity"];def js = "TheMovieDB::TV";def wV = [[ 74180, js],[ 93821, js],[ 95897, js],[220118, js],[271026, js]];def oA = [[236530, js]];def iw = any { info.database } { id == tmdbid ? "TheMovieDB" : "IMDb" };def Ub = iw == "IMDb" ? "tt${id}" : id;def zP = any { info.adult } { false };def gf = wV.find { it[0] == Ub && it[1] == iw } != null;def Zlm = oA.find { it[0] == Ub && it[1] == iw } != null;def PL = info.Keywords.findAll { it in ip } || gf || zP;PL = Zlm ? false : PL;PL ? "R18+ " : ""}{def Et = ["CN", "JP", "KR", "KP", "TW", "HK"];def sX = ["aeni", "donghua", "anime"];def My = any {anime} || info.Keywords.findAll { it in sX } || (Et.contains(country) && genres =~ /Animation/);My ? "Anime Movies/" : "Movies/"}{def js = "TheMovieDB::TV";def yv = [[Fr: 68854, xIB: "From Me to You", Kmr: js],[Fr: 219816, xIB: "Fate/Grand Order: Fujimaru Ritsuka Doesn't Get It", Kmr: js],[Fr: 259559, xIB: "Headhunted to Another World", Kmr: js],[Fr: 276204, xIB: "Bogus Skill Fruitmaster", Kmr: js]];def iw = any { info.database } { id == tmdbid ? "TheMovieDB" : "IMDb" };def Ub = iw == "IMDb" ? "tt${id}" : id;def NG = n;yv.each {if (it.Fr == Ub && it.Kmr == iw) {NG = it.xIB}};def fYM = ['\\', '/', ':', '*', '?', '"', '<', '>', '|'];def Fq = NG.replaceAll(fYM.collect { "\\" + it }.join('|'), '');Fq = Fq.replaceAll(/(\s|\.)*$/, '');Fq}{" ("}{y}{")"}{"/"}{def Pi = ["Alqanime","BlackLuster","Kuramanime","NanDesuKa","ToonsHub","Tsundere-Raws","Samehadaku"];def GXS = Pi.find { VjH -> fn.lower().contains(VjH.lower()) } ?: "";def avC = any {(fn =~ /^\[(.*?)\]/)[0][1]} {GXS} {group} {""};avC ? "[$avC] " : ""}{def js = "TheMovieDB::TV";def yv = [[Fr: 68854, xIB: "From Me to You", Kmr: js],[Fr: 219816, xIB: "Fate/Grand Order: Fujimaru Ritsuka Doesn't Get It", Kmr: js],[Fr: 259559, xIB: "Headhunted to Another World", Kmr: js],[Fr: 276204, xIB: "Bogus Skill Fruitmaster", Kmr: js]];def iw = any { info.database } { id == tmdbid ? "TheMovieDB" : "IMDb" };def Ub = iw == "IMDb" ? "tt${id}" : id;def NG = n;yv.each {if (it.Fr == Ub && it.Kmr == iw) {NG = it.xIB}};def fYM = ['\\', '/', ':', '*', '?', '"', '<', '>', '|'];def Fq = NG.replaceAll(fYM.collect { "\\" + it }.join('|'), '');Fq = Fq.replaceAll(/(\s|\.)*$/, '');Fq}{" ("}{y}{")"}{" ["}{def sZ = [["ABEMA"],["ADN"],["BBC"],["BILI", "B-Global", "BiliIntl", "B-Site", "BiliCN"],["COOLMIC"],["HIDIVE", "HIDI.WEB-DL"],["IQIYI", "IQ.WEB-DL"],["JFFP"],["LAFTEL", "LFTL"],["MDON", "MANGADON"],["MW.WEB-DL"],["NF.WEB-DL", "NF WEB"],["SHAHID"],["TVER"],["UNEXT"],["WETV"],["YTB", "YT.WEB-DL", "YOUTUBE"]];def TfN = ["ASW", "Judas", "JRx7", "EMBER", "KawaSubs", "GuodongSubs", "SAMEHADAKU"];def Vi = ["Erai-raws", "SubsPlease"];def fUL = any {(fn =~ /^\[(.*?)\]/)[0][1]} {""};def htD = any {def W_ = sZ.find { FGW -> FGW.find { op -> fn.lower().contains(op.lower()) } }[0];W_ = W_.replace(".WEB-DL", "");def Msw = source.contains("WEB-DL");def RVG = source ? ".${source}" : "";Msw ? "${W_}.WEB-DL" : W_ ? "${W_}${RVG}" : ""} {fUL == "BiliIntl" ? "BILI.WEB-DL" : ""} {source} {TfN.find { c_S -> group == c_S || fUL == c_S } ? "WEBRip" : ""} {def aw = Vi.find { SDe -> group == SDe || fUL == SDe} ? "WEB-DL" : "";(source == "Erai-raws" && vcf.upper() == "HEVC") ? "WEBRip" : aw} {vs} {""};htD ? "$htD " : ""}{def UN = bitdepth ? " ${bitdepth}bit" : "";"$resolution $vcf $UN, $ac"}{" "}{af.format(8: 'DD+ 7.1',7: '6.1',6: 'DD 5.1',5: '5.0',3: '2.1',2: '2.0',1: '1.0')}{def Vx = " Dub";def aIK = audioLanguages.any { it.ISO3B == language.ISO3B } ? "" : Vx;aIK = audioLanguages.size() == 1 && audioLanguages.any { it.ISO3B == "und" } ? "" : aIK;aIK}{def pTk = any { audioLanguages.size() } { 0 };def aIK = pTk > 2 ? " MAud" : pTk > 1 ? " DAud" : null;def rAN = pTk > 5 ? audioLanguages.take(5) : audioLanguages;aIK ? aIK + rAN.joining(" ", " (", "").upper() + (pTk > 5 ? " ...)" : ")") : ""}{def Ka = any { textLanguages.size() } { 0 };def aIK = Ka > 2 ? ", MSub" : Ka > 1 ? ", DSub" : null;def rAN = Ka > 5 ? textLanguages.take(5) : textLanguages;aIK ? aIK + rAN.joining(" ", " (", "").upper() + (Ka > 5 ? " ...)" : ")") : ""}{"]["}{crc32.upper()}{"]"}{if (f.subtitle) {def WR = ["name": "." + lang.name,"iso3b": "." + lang.ISO3B,"iso3": "." +lang.ISO3,"iso2": "." + lang.ISO2];def GC = subt;WR.values().each { VUy -> if (GC.contains(VUy)) {GC = GC.replace(VUy, "")}};WR.iso3b + GC}}{f.image ? "-thumb" : ""} \ No newline at end of file diff --git a/compiled/music_shared.groovy b/compiled/music_shared.groovy index 7c49a34..32f00ad 100644 --- a/compiled/music_shared.groovy +++ b/compiled/music_shared.groovy @@ -1 +1 @@ -{def RU = { System.getProperty(it) };def CAT = RU("os.name").toLowerCase().contains("windows");def CoB = RU("user.name");def yc = "/run/media/${CoB}";def lYg = CAT ? "H:/" : "$yc/Videos";def hZ = [[BY: "Books", Fa: "F:/", AN: "$yc/Books"],[BY: "Data", Fa: "D:/", AN: "$yc/Data"],[BY: "Games", Fa: "G:/", AN: "$yc/Games"],[BY: "Music", Fa: "E:/", AN: "$yc/Music"],[BY: "Videos", Fa: "H:/", AN: "$yc/Videos"]];def xa = (hZ.collect { it[CAT ? "Fa" : "AN"] as File }.sort { O_, ro -> O_.exists() <=> ro.exists() ?: O_.diskSpace <=> ro.diskSpace }).last();def Jzx = lYg ?: xa;"$Jzx/"}{"Torrent Uploads/"}{ext.upper()}{"/"}{y}{"/["}{d.format("yyyy.MM.dd")}{"] "}{album}{" - "}{n}{" ["}{ext.upper()}{ext == "flac" ? " " + "${ bitdepth > 16 ? bitdepth + '-' : ''}" + khz : ext == "mp3" && media.get("OverallBitRate/String") != "320 kbps" ? " V0" : ""}{"]"}{media.CATALOGNUMBER ? "[" + media.CATALOGNUMBER + "]" : ""}{"/"}{dc > 1 ? "Disc " + di + "/" : ""}{dc? di + "-": ""}{pi.pad(2)}{" "}{t} \ No newline at end of file +{def rLH = { System.getProperty(it) };def Cuh = rLH("os.name").toLowerCase().contains("windows");def aJ = rLH("user.name");def vpI = "/run/media/${aJ}";def Df = Cuh ? "H:/" : "$vpI/Videos";def kwy = [[GGw: "Books", AS: "F:/", Syf: "$vpI/Books"],[GGw: "Data", AS: "D:/", Syf: "$vpI/Data"],[GGw: "Games", AS: "G:/", Syf: "$vpI/Games"],[GGw: "Music", AS: "E:/", Syf: "$vpI/Music"],[GGw: "Videos", AS: "H:/", Syf: "$vpI/Videos"]];def qG = (kwy.collect { it[Cuh ? "AS" : "Syf"] as File }.sort { BP, Ps -> BP.exists() <=> Ps.exists() ?: BP.diskSpace <=> Ps.diskSpace }).last();def _R = Df ?: qG;"$_R/"}{"Torrent Uploads/"}{ext.upper()}{"/"}{y}{"/["}{d.format("yyyy.MM.dd")}{"] "}{album}{" - "}{n}{" ["}{ext.upper()}{ext == "flac" ? " " + "${ bitdepth > 16 ? bitdepth + '-' : ''}" + khz : ext == "mp3" && media.get("OverallBitRate/String") != "320 kbps" ? " V0" : ""}{"]"}{media.CATALOGNUMBER ? "[" + media.CATALOGNUMBER + "]" : ""}{"/"}{dc > 1 ? "Disc " + di + "/" : ""}{dc? di + "-": ""}{pi.pad(2)}{" "}{t} \ No newline at end of file diff --git a/compiled/post_xmbcnfo.groovy b/compiled/post_xmbcnfo.groovy index d773397..5f4b662 100644 --- a/compiled/post_xmbcnfo.groovy +++ b/compiled/post_xmbcnfo.groovy @@ -1 +1 @@ -{ source, target, metadata -> if (type.toString() != "Episode" && !f.video) {return null};def vQ = target.dir;def uQ = any{ s } { 0 };def LyS = any{ e } { special };def YsY = 0;def OVf = null;try {if (db.TheTVDB?.id) {def grn = "https://api.tvmaze.com";def EvU = curl "$grn/lookup/shows?thetvdb=${db.TheTVDB.id}";def jOK = EvU.id;OVf = curl "$grn/shows/$jOK/episodebynumber?season=$uQ&number=$LyS";YsY = OVf.id}} catch (Exception err) {};def UEd = "";def KL = "en-US";def lb = null;def nl = new File("$home/.filebotsecrets.json");if (nl.exists()) {def EPS = new groovy.json.JsonSlurper().parseText(nl.text);UEd = EPS.UEd;KL = EPS.language;lb = EPS.person_info_dir};def bqW = "https://api.themoviedb.org/3/tv/$id/season/$uQ/episode/$LyS";def jVF = ["accept": "application/json"];def UCU = curl(jVF, "$bqW?language=$KL&api_key=$UEd");def CIZ = curl(jVF, "$bqW/external_ids?api_key=$UEd");def oJr = curl(jVF, "$bqW/credits?language=$KL&api_key=$UEd");def mT = curl(jVF, "$bqW/images?include_image_language=en%2Cnull&api_key=$UEd");def rVT = (vQ / target.nameWithoutExtension + "-thumb.jpg").toString();def gsx = new File(rVT);def jDP = new File(rVT.replace("-thumb",""));if (!(gsx.exists() || jDP.exists()) && mT.stills.size() > 0) {def CG = "https://image.tmdb.org/t/p/original${mT.stills[0].file_path}";system "curl", "-o", vQ / target.nameWithoutExtension + "-thumb.jpg", CG};def wR_ = [];(oJr.cast + oJr.guest_stars).eachWithIndex { paf, fuj -> def VWI = "$lb/${paf.name[0]}/${paf.name}";def dP = paf.order ?: fuj + wR_.size();wR_ << [gdJ: paf.name, WbT: paf.character, du: dP, VWI: "${VWI}/folder.jpg"];if (lb) {def Mc = new File(VWI);if (!Mc.exists()) {Mc.mkdirs();system "curl", "-o", "${VWI}/folder.jpg", "https://image.tmdb.org/t/p/original${paf.profile_path}"}}};def HTX = vQ / target.nameWithoutExtension + ".nfo";XML(HTX) {mkp.xmlDeclaration(version: "1.0", encoding: "utf-8", standalone: "yes");episodedetails {plot(UCU.overview);lockdata("false");dateadded(new Date().format("yyyy-MM-dd HH:mm:ss", TimeZone.getTimeZone("UTC")));title(t);originaltitle(localize."${languages[0]}".t);rating(rating);year(airdate.format("yyyy"));uniqueid(type: "tmdb", value: episode.id, 'default': "true", episode.id);tmdbid(episode.id);if (CIZ?.imdb_id) {uniqueid(type: "imdb", value: CIZ.imdb_id, CIZ.imdb_id);imdbid(CIZ.imdb_id)};if (CIZ?.tvdb_id) {uniqueid(type: "tvdb", value: CIZ.tvdb_id, CIZ.tvdb_id);tvdbid(CIZ.tvdb_id)};try {runtime(runtime)} catch (Exception err) {runtime(minutes)};try {if (db.AniDB?.episode?.id) {uniqueid(type: "anidb", value: db.AniDB.episode.id, db.AniDB.episode.id);anidbid(db.AniDB.episode.id)}} catch (Exception err) {};try {if (YsY) {uniqueid(type: "tvmaze", value: YsY, YsY);tvmazeid(YsY)}} catch (Exception err) {};if (gsx.exists()) {art {poster(rVT)}};wR_.each { ze -> actor {name(ze.gdJ);role(ze.WbT);sortorder(ze.du);if (lb) { thumb(ze.VWI) }}};showtitle(n);episode(LyS);season(uQ);aired(airdate.format("yyyy-MM-dd"));fileinfo {streamdetails {target.mediaInfo.Video.each { vU -> video {def FRP = Float.parseFloat(vU.'Duration');codec(vU.'Format');micodec(vU.'Format');bitrate(vU.'BitRate');width(vU.'Width');height(vU.'Height');aspect(vU.'DisplayAspectRatio/String');aspectratio(vU.'DisplayAspectRatio/String');framerate(vU.'FrameRate');'default'(vU.'Default' == "Yes" ? "True" : "False");forced(vU.'Forced' == "Yes" ? "True" : "False");duration(vU.'Duration' ? (int) Math.floor(FRP / 60000) : 0);durationinseconds(vU.'Duration' ? (int) Math.floor(FRP / 1000) : 0)}};target.mediaInfo.Audio.each { znG -> audio {codec(znG.'Format');micodec(znG.'Format');language(znG.'Language/String3');channels(znG.'Channel(s)');samplingrate(znG.'SamplingRate');'default'(znG.'Default' == "Yes" ? "True" : "False");forced(znG.'Forced' == "Yes" ? "True" : "False")}};target.mediaInfo.Text.each { pnu -> subtitle {codec(pnu.'Format');micodec(pnu.'Format');width('0');height('0');language(pnu.'Language/String3');'default'(pnu.'Default' == "Yes" ? "True" : "False");forced(pnu.'Forced' == "Yes" ? "True" : "False")}}}}}}} \ No newline at end of file +{ source, target, metadata -> if (type.toString() != "Episode" && !f.video) {return null};def cg = target.dir;def Vmj = any{ s } { 0 };def vx = any{ e } { special };def SgF = 0;def Wv = null;try {if (db.TheTVDB?.id) {def nPo = "https://api.tvmaze.com";def lP = curl "$nPo/lookup/shows?thetvdb=${db.TheTVDB.id}";def Ah = lP.id;Wv = curl "$nPo/shows/$Ah/episodebynumber?season=$Vmj&number=$vx";SgF = Wv.id}} catch (Exception err) {};def LRD = "";def Sx = "en-US";def Mn = null;def XzH = new File("$home/.filebotsecrets.json");if (XzH.exists()) {def IYA = new groovy.json.JsonSlurper().parseText(XzH.text);LRD = IYA.LRD;Sx = IYA.language;Mn = IYA.person_info_dir};def Vo = "https://api.themoviedb.org/3/tv/$id/season/$Vmj/episode/$vx";def jc = ["accept": "application/json"];def QnU = curl(jc, "$Vo?language=$Sx&api_key=$LRD");def EJU = curl(jc, "$Vo/external_ids?api_key=$LRD");def kWj = curl(jc, "$Vo/credits?language=$Sx&api_key=$LRD");def NY = curl(jc, "$Vo/images?include_image_language=en%2Cnull&api_key=$LRD");def Wk = (cg / target.nameWithoutExtension + "-thumb.jpg").toString();def hJU = new File(Wk);def dX = new File(Wk.replace("-thumb",""));if (!(hJU.exists() || dX.exists()) && NY.stills.size() > 0) {def RDJ = "https://image.tmdb.org/t/p/original${NY.stills[0].file_path}";system "curl", "-o", cg / target.nameWithoutExtension + "-thumb.jpg", RDJ};def SYC = [];(kWj.cast + kWj.guest_stars).eachWithIndex { BFp, vVh -> def zmb = "$Mn/${BFp.name[0]}/${BFp.name}";def Vb = BFp.order ?: vVh + SYC.size();SYC << [Myt: BFp.name, pD: BFp.character, Ztp: Vb, zmb: "${zmb}/folder.jpg"];if (Mn) {def VMG = new File(zmb);if (!VMG.exists()) {VMG.mkdirs();system "curl", "-o", "${zmb}/folder.jpg", "https://image.tmdb.org/t/p/original${BFp.profile_path}"}}};def iX = cg / target.nameWithoutExtension + ".nfo";XML(iX) {mkp.xmlDeclaration(version: "1.0", encoding: "utf-8", standalone: "yes");episodedetails {plot(QnU.overview);lockdata("false");dateadded(new Date().format("yyyy-MM-dd HH:mm:ss", TimeZone.getTimeZone("UTC")));title(t);originaltitle(localize."${languages[0]}".t);rating(rating);year(airdate.format("yyyy"));uniqueid(type: "tmdb", value: episode.id, 'default': "true", episode.id);tmdbid(episode.id);if (EJU?.imdb_id) {uniqueid(type: "imdb", value: EJU.imdb_id, EJU.imdb_id);imdbid(EJU.imdb_id)};if (EJU?.tvdb_id) {uniqueid(type: "tvdb", value: EJU.tvdb_id, EJU.tvdb_id);tvdbid(EJU.tvdb_id)};try {runtime(runtime)} catch (Exception err) {runtime(minutes)};try {if (db.AniDB?.episode?.id) {uniqueid(type: "anidb", value: db.AniDB.episode.id, db.AniDB.episode.id);anidbid(db.AniDB.episode.id)}} catch (Exception err) {};try {if (SgF) {uniqueid(type: "tvmaze", value: SgF, SgF);tvmazeid(SgF)}} catch (Exception err) {};if (hJU.exists()) {art {poster(Wk)}};SYC.each { Ir -> actor {name(Ir.Myt);role(Ir.pD);sortorder(Ir.Ztp);if (Mn) { thumb(Ir.zmb) }}};showtitle(n);episode(vx);season(Vmj);aired(airdate.format("yyyy-MM-dd"));fileinfo {streamdetails {target.mediaInfo.Video.each { W_ -> video {def FIv = Float.parseFloat(W_.'Duration');codec(W_.'Format');micodec(W_.'Format');bitrate(W_.'BitRate');width(W_.'Width');height(W_.'Height');aspect(W_.'DisplayAspectRatio/String');aspectratio(W_.'DisplayAspectRatio/String');framerate(W_.'FrameRate');'default'(W_.'Default' == "Yes" ? "True" : "False");forced(W_.'Forced' == "Yes" ? "True" : "False");duration(W_.'Duration' ? (int) Math.floor(FIv / 60000) : 0);durationinseconds(W_.'Duration' ? (int) Math.floor(FIv / 1000) : 0)}};target.mediaInfo.Audio.each { Vm -> audio {codec(Vm.'Format');micodec(Vm.'Format');language(Vm.'Language/String3');channels(Vm.'Channel(s)');samplingrate(Vm.'SamplingRate');'default'(Vm.'Default' == "Yes" ? "True" : "False");forced(Vm.'Forced' == "Yes" ? "True" : "False")}};target.mediaInfo.Text.each { mw -> subtitle {codec(mw.'Format');micodec(mw.'Format');width('0');height('0');language(mw.'Language/String3');'default'(mw.'Default' == "Yes" ? "True" : "False");forced(mw.'Forced' == "Yes" ? "True" : "False")}}}}}}} \ No newline at end of file diff --git a/compiled/tv.groovy b/compiled/tv.groovy index b5cc9b4..9c9ff6e 100644 --- a/compiled/tv.groovy +++ b/compiled/tv.groovy @@ -1 +1 @@ -{def mg = { System.getProperty(it) };def cG = mg("os.name").toLowerCase().contains("windows");def aUy = mg("user.name");def ZZ = "/run/media/${aUy}";def sQt = cG ? "H:/" : "$ZZ/Videos";def bF = [[NJ: "Books", sQ: "F:/", WL: "$ZZ/Books"],[NJ: "Data", sQ: "D:/", WL: "$ZZ/Data"],[NJ: "Games", sQ: "G:/", WL: "$ZZ/Games"],[NJ: "Music", sQ: "E:/", WL: "$ZZ/Music"],[NJ: "Videos", sQ: "H:/", WL: "$ZZ/Videos"]];def IPT = (bF.collect { it[cG ? "sQ" : "WL"] as File }.sort { sf, _VB -> sf.exists() <=> _VB.exists() ?: sf.diskSpace <=> _VB.diskSpace }).last();def Lor = sQt ?: IPT;"$Lor/"}{"Videos/"}{def aX_ = ["boys' love (bl)", "gay theme", "yaoi", "yuri", "lesbian", "hentai","sex", "lgbt", "explicit", "adult animation", "adult content","nudity"];def JWJ = "TheMovieDB::TV";def Pdz = [[ 74180, JWJ],[ 93821, JWJ],[ 95897, JWJ],[220118, JWJ],[271026, JWJ]];def GK = [[236530, JWJ]];def zR = any { info.database } { id == tmdbid ? "TheMovieDB" : "IMDb" };def eG = zR == "IMDb" ? "tt${id}" : id;def Kvj = any { info.adult } { false };def Ps = Pdz.find { it[0] == eG && it[1] == zR } != null;def Ab = GK.find { it[0] == eG && it[1] == zR } != null;def Rm = info.Keywords.findAll { it in aX_ } || Ps || Kvj;Rm = Ab ? false : Rm;Rm ? "R18+ " : ""}{def ez = ["CN", "JP", "KR", "KP", "TW", "HK"];def YK = ["aeni", "donghua", "anime"];def Uq = any {anime} || info.Keywords.findAll { it in YK } || (ez.contains(country) && genres =~ /Animation/);Uq ? "Anime/" : "TV Series/"}{def JWJ = "TheMovieDB::TV";def FQg = [[psh: 68854, TvZ: "From Me to You", xa: JWJ],[psh: 219816, TvZ: "Fate/Grand Order: Fujimaru Ritsuka Doesn't Get It", xa: JWJ],[psh: 259559, TvZ: "Headhunted to Another World", xa: JWJ],[psh: 276204, TvZ: "Bogus Skill Fruitmaster", xa: JWJ]];def zR = any { info.database } { id == tmdbid ? "TheMovieDB" : "IMDb" };def eG = zR == "IMDb" ? "tt${id}" : id;def Cc = n;FQg.each {if (it.psh == eG && it.xa == zR) {Cc = it.TvZ}};def lL = ['\\', '/', ':', '*', '?', '"', '<', '>', '|'];def Ij = Cc.replaceAll(lL.collect { "\\" + it }.join('|'), '');Ij = Ij.replaceAll(/(\s|\.)*$/, '');Ij}{def JWJ = "TheMovieDB::TV";def jGO = [[ 95897, JWJ],[123542, JWJ],[235973, JWJ],[239779, JWJ],[257162, JWJ],[259140, JWJ],[276204, JWJ]];def GS = jGO.find { it[0] == id && it[1] == info.database } != null;def fI = ["TheMovieDB::TV": "tmdbid","AniDB": "anidbid","TheTVDB": "tvdbid","TVmaze": "tvmazeid"];def vh = fI[info.database];GS ? " ($y) [${vh}-${id}]" : ""}{"/"}{episode.special ? 'Specials' : 'Season '+s}{def lL = ['\\', '/', ':', '*', '?', '"', '<', '>', '|'];def Ij = sn.replaceAll(lL.collect { "\\" + it }.join('|'), '_');def HpL = n.replaceAll(lL.collect { "\\" + it }.join('|'), '_');def OnH = Ij.contains(HpL) ? "" : Ij;OnH == 'Season '+ s ? "" : OnH ? " - " + OnH : ""}{"/"}{def Um = ["Alqanime","BlackLuster","Kuramanime","NanDesuKa","ToonsHub","Tsundere-Raws","Samehadaku"];def dnI = Um.find { wmK -> fn.lower().contains(wmK.lower()) } ?: "";def Aal = any {(fn =~ /^\[(.*?)\]/)[0][1]} {dnI} {group} {""};Aal ? "[$Aal] " : ""}{def JWJ = "TheMovieDB::TV";def FQg = [[psh: 68854, TvZ: "From Me to You", xa: JWJ],[psh: 219816, TvZ: "Fate/Grand Order: Fujimaru Ritsuka Doesn't Get It", xa: JWJ],[psh: 259559, TvZ: "Headhunted to Another World", xa: JWJ],[psh: 276204, TvZ: "Bogus Skill Fruitmaster", xa: JWJ]];def zR = any { info.database } { id == tmdbid ? "TheMovieDB" : "IMDb" };def eG = zR == "IMDb" ? "tt${id}" : id;def Cc = n;FQg.each {if (it.psh == eG && it.xa == zR) {Cc = it.TvZ}};def lL = ['\\', '/', ':', '*', '?', '"', '<', '>', '|'];def Ij = Cc.replaceAll(lL.collect { "\\" + it }.join('|'), '');Ij = Ij.replaceAll(/(\s|\.)*$/, '');Ij}{" - "}{s00e00}{def lL = ['\\', '/', ':', '*', '?', '"', '<', '>', '|'];def Ij = t.replaceAll(lL.collect { "\\" + it }.join('|'), '_');def VwN = any { e } { special };Ij = Ij.length() > 100 ? " " : " - $Ij ";Ij == " - Episode $VwN " ? " " : Ij}{" ["}{def Ff_ = [["ABEMA"],["ADN"],["BBC"],["BILI", "B-Global", "BiliIntl", "B-Site", "BiliCN"],["COOLMIC"],["HIDIVE", "HIDI.WEB-DL"],["IQIYI", "IQ.WEB-DL"],["JFFP"],["LAFTEL", "LFTL"],["MDON", "MANGADON"],["MW.WEB-DL"],["NF.WEB-DL", "NF WEB"],["SHAHID"],["TVER"],["UNEXT"],["WETV"],["YT.WEB-DL", "YOUTUBE", "YTB"]];def _iE = ["ASW", "Judas", "JRx7", "EMBER", "KawaSubs", "GuodongSubs", "SAMEHADAKU"];def ey = ["Erai-raws", "SubsPlease"];def rJf = any {(fn =~ /^\[(.*?)\]/)[0][1]} {""};def iOz = any {def SF = Ff_.find { NA -> NA.find { BhX -> fn.lower().contains(BhX.lower()) } }[0];SF = SF.replace(".WEB-DL", "");def PQ = source.contains("WEB-DL");def mT = source ? ".${source}" : "";PQ ? "${SF}.WEB-DL" : SF ? "${SF}${mT}" : ""} {} {source} {_iE.find { MDT -> group == MDT || rJf == MDT } ? "WEBRip" : ""} {def MF = ey.find { BC -> group == BC || rJf == BC} ? "WEB-DL" : "";(source == "Erai-raws" && vcf.upper() == "HEVC") ? "WEBRip" : MF} {vs} {""};iOz ? "$iOz " : ""}{def rOH = bitdepth ? " ${bitdepth}bit" : "";"$resolution $vcf $rOH, $ac"}{" "}{af.format(8: 'DD+ 7.1',7: '6.1',6: 'DD 5.1',5: '5.0',3: '2.1',2: '2.0',1: '1.0')}{def p_ = " Dub";def kS = audioLanguages.any { it.ISO3B == language.ISO3B } ? "" : p_;kS = audioLanguages.size() == 1 && audioLanguages.any { it.ISO3B == "und" } ? "" : kS;kS}{def hD = any { audioLanguages.size() } { 0 };def kS = hD > 2 ? " MAud" : hD > 1 ? " DAud" : null;def rY = hD > 5 ? audioLanguages.take(5) : audioLanguages;kS ? kS + rY.joining(" ", " (", "").upper() + (hD > 5 ? " ...)" : ")") : ""}{def fwJ = any { textLanguages.size() } { 0 };def kS = fwJ > 2 ? ", MSub" : fwJ > 1 ? ", DSub" : null;def rY = fwJ > 5 ? textLanguages.take(5) : textLanguages;kS ? kS + rY.joining(" ", " (", "").upper() + (fwJ > 5 ? " ...)" : ")") : ""}{"]["}{crc32.upper()}{"]"}{if (f.subtitle) {def oVn = ["name": "." + lang.name,"iso3b": "." + lang.ISO3B,"iso3": "." +lang.ISO3,"iso2": "." + lang.ISO2];def dC = subt;oVn.values().each { XC -> if (dC.contains(XC)) {dC = dC.replace(XC, "")}};oVn.iso3b + dC}}{f.image ? "-thumb" : ""} \ No newline at end of file +{def Tk = { System.getProperty(it) };def _dS = Tk("os.name").toLowerCase().contains("windows");def YTD = Tk("user.name");def l_ = "/run/media/${YTD}";def rr = _dS ? "H:/" : "$l_/Videos";def Rt = [[wOc: "Books", uWA: "F:/", XbI: "$l_/Books"],[wOc: "Data", uWA: "D:/", XbI: "$l_/Data"],[wOc: "Games", uWA: "G:/", XbI: "$l_/Games"],[wOc: "Music", uWA: "E:/", XbI: "$l_/Music"],[wOc: "Videos", uWA: "H:/", XbI: "$l_/Videos"]];def rxS = (Rt.collect { it[_dS ? "uWA" : "XbI"] as File }.sort { xcC, YRi -> xcC.exists() <=> YRi.exists() ?: xcC.diskSpace <=> YRi.diskSpace }).last();def _S = rr ?: rxS;"$_S/"}{"Videos/"}{def IiU = ["boys' love (bl)", "gay theme", "yaoi", "yuri", "lesbian", "hentai","sex", "lgbt", "explicit", "adult animation", "adult content","nudity"];def y_ = "TheMovieDB::TV";def Cpy = [[ 74180, y_],[ 93821, y_],[ 95897, y_],[220118, y_],[271026, y_]];def qCT = [[236530, y_]];def AQ = any { info.database } { id == tmdbid ? "TheMovieDB" : "IMDb" };def ea = AQ == "IMDb" ? "tt${id}" : id;def ed = any { info.adult } { false };def lSo = Cpy.find { it[0] == ea && it[1] == AQ } != null;def oN = qCT.find { it[0] == ea && it[1] == AQ } != null;def HL = info.Keywords.findAll { it in IiU } || lSo || ed;HL = oN ? false : HL;HL ? "R18+ " : ""}{def zy = ["CN", "JP", "KR", "KP", "TW", "HK"];def Zxu = ["aeni", "donghua", "anime"];def ft = any {anime} || info.Keywords.findAll { it in Zxu } || (zy.contains(country) && genres =~ /Animation/);ft ? "Anime/" : "TV Series/"}{def y_ = "TheMovieDB::TV";def rv = [[xN: 68854, Rj: "From Me to You", deV: y_],[xN: 219816, Rj: "Fate/Grand Order: Fujimaru Ritsuka Doesn't Get It", deV: y_],[xN: 259559, Rj: "Headhunted to Another World", deV: y_],[xN: 276204, Rj: "Bogus Skill Fruitmaster", deV: y_]];def AQ = any { info.database } { id == tmdbid ? "TheMovieDB" : "IMDb" };def ea = AQ == "IMDb" ? "tt${id}" : id;def lVZ = n;rv.each {if (it.xN == ea && it.deV == AQ) {lVZ = it.Rj}};def nFo = ['\\', '/', ':', '*', '?', '"', '<', '>', '|'];def PO = lVZ.replaceAll(nFo.collect { "\\" + it }.join('|'), '');PO = PO.replaceAll(/(\s|\.)*$/, '');PO}{def y_ = "TheMovieDB::TV";def Bqi = [[ 95897, y_],[123542, y_],[235973, y_],[239779, y_],[257162, y_],[259140, y_],[276204, y_]];def Qt = Bqi.find { it[0] == id && it[1] == info.database } != null;def yO = ["TheMovieDB::TV": "tmdbid","AniDB": "anidbid","TheTVDB": "tvdbid","TVmaze": "tvmazeid"];def ht = yO[info.database];Qt ? " ($y) [${ht}-${id}]" : ""}{"/"}{episode.special ? 'Specials' : 'Season '+s}{def nFo = ['\\', '/', ':', '*', '?', '"', '<', '>', '|'];def PO = sn.replaceAll(nFo.collect { "\\" + it }.join('|'), '_');def xjU = n.replaceAll(nFo.collect { "\\" + it }.join('|'), '_');def nR = PO.contains(xjU) ? "" : PO;nR == 'Season '+ s ? "" : nR ? " - " + nR : ""}{"/"}{def iM = ["Alqanime","BlackLuster","Kuramanime","NanDesuKa","ToonsHub","Tsundere-Raws","Samehadaku"];def uJ = iM.find { sRL -> fn.lower().contains(sRL.lower()) } ?: "";def MnZ = any {(fn =~ /^\[(.*?)\]/)[0][1]} {uJ} {group} {""};MnZ ? "[$MnZ] " : ""}{def y_ = "TheMovieDB::TV";def rv = [[xN: 68854, Rj: "From Me to You", deV: y_],[xN: 219816, Rj: "Fate/Grand Order: Fujimaru Ritsuka Doesn't Get It", deV: y_],[xN: 259559, Rj: "Headhunted to Another World", deV: y_],[xN: 276204, Rj: "Bogus Skill Fruitmaster", deV: y_]];def AQ = any { info.database } { id == tmdbid ? "TheMovieDB" : "IMDb" };def ea = AQ == "IMDb" ? "tt${id}" : id;def lVZ = n;rv.each {if (it.xN == ea && it.deV == AQ) {lVZ = it.Rj}};def nFo = ['\\', '/', ':', '*', '?', '"', '<', '>', '|'];def PO = lVZ.replaceAll(nFo.collect { "\\" + it }.join('|'), '');PO = PO.replaceAll(/(\s|\.)*$/, '');PO}{" - "}{s00e00}{def nFo = ['\\', '/', ':', '*', '?', '"', '<', '>', '|'];def PO = t.replaceAll(nFo.collect { "\\" + it }.join('|'), '_');def Fhn = any { e } { special };PO = PO.length() > 100 ? " " : " - $PO ";PO == " - Episode $Fhn " ? " " : PO}{" ["}{def MtS = [["ABEMA"],["ADN"],["BBC"],["BILI", "B-Global", "BiliIntl", "B-Site", "BiliCN"],["COOLMIC"],["HIDIVE", "HIDI.WEB-DL"],["IQIYI", "IQ.WEB-DL"],["JFFP"],["LAFTEL", "LFTL"],["MDON", "MANGADON"],["MW.WEB-DL"],["NF.WEB-DL", "NF WEB"],["SHAHID"],["TVER"],["UNEXT"],["WETV"],["YTB", "YT.WEB-DL", "YOUTUBE"]];def AB = ["ASW", "Judas", "JRx7", "EMBER", "KawaSubs", "GuodongSubs", "SAMEHADAKU"];def oId = ["Erai-raws", "SubsPlease"];def dh = any {(fn =~ /^\[(.*?)\]/)[0][1]} {""};def Hj = any {def wru = MtS.find { YIm -> YIm.find { bhh -> fn.lower().contains(bhh.lower()) } }[0];wru = wru.replace(".WEB-DL", "");def XOz = source.contains("WEB-DL");def iil = source ? ".${source}" : "";XOz ? "${wru}.WEB-DL" : wru ? "${wru}${iil}" : ""} {dh == "BiliIntl" ? "BILI.WEB-DL" : ""} {source} {AB.find { KRu -> group == KRu || dh == KRu } ? "WEBRip" : ""} {def qA = oId.find { TC -> group == TC || dh == TC} ? "WEB-DL" : "";(source == "Erai-raws" && vcf.upper() == "HEVC") ? "WEBRip" : qA} {vs} {""};Hj ? "$Hj " : ""}{def Mv = bitdepth ? " ${bitdepth}bit" : "";"$resolution $vcf $Mv, $ac"}{" "}{af.format(8: 'DD+ 7.1',7: '6.1',6: 'DD 5.1',5: '5.0',3: '2.1',2: '2.0',1: '1.0')}{def xfm = " Dub";def QG = audioLanguages.any { it.ISO3B == language.ISO3B } ? "" : xfm;QG = audioLanguages.size() == 1 && audioLanguages.any { it.ISO3B == "und" } ? "" : QG;QG}{def zO = any { audioLanguages.size() } { 0 };def QG = zO > 2 ? " MAud" : zO > 1 ? " DAud" : null;def XVC = zO > 5 ? audioLanguages.take(5) : audioLanguages;QG ? QG + XVC.joining(" ", " (", "").upper() + (zO > 5 ? " ...)" : ")") : ""}{def tMy = any { textLanguages.size() } { 0 };def QG = tMy > 2 ? ", MSub" : tMy > 1 ? ", DSub" : null;def XVC = tMy > 5 ? textLanguages.take(5) : textLanguages;QG ? QG + XVC.joining(" ", " (", "").upper() + (tMy > 5 ? " ...)" : ")") : ""}{"]["}{crc32.upper()}{"]"}{if (f.subtitle) {def bSX = ["name": "." + lang.name,"iso3b": "." + lang.ISO3B,"iso3": "." +lang.ISO3,"iso2": "." + lang.ISO2];def LPy = subt;bSX.values().each { JGI -> if (LPy.contains(JGI)) {LPy = LPy.replace(JGI, "")}};bSX.iso3b + LPy}}{f.image ? "-thumb" : ""} \ No newline at end of file