From 79aba73029777ba54f87324205d5675dbb87c981 Mon Sep 17 00:00:00 2001 From: damiva <96115589+damiva@users.noreply.github.com> Date: Mon, 24 Jan 2022 01:31:41 +0300 Subject: [PATCH] Add files via upload --- build.sh | 2 +- tivix/favs.json | 2 +- tivix/main.tengo | 20 +++++++++++--------- tivix/video.tengo | 4 +--- torlook/magnet.tengo | 5 ++++- torlook/main.tengo | 32 +++++++++++++++++++++----------- torlook/settings.tengo | 29 +++++++++++++++-------------- 7 files changed, 54 insertions(+), 40 deletions(-) diff --git a/build.sh b/build.sh index 7bc3d04..9cb9746 100644 --- a/build.sh +++ b/build.sh @@ -4,7 +4,7 @@ for d in *; do if [ -d "$d" ]; then echo -e "\n> $d.plug:" cd $d - tar -cvzf ../$d.200.tgz * + tar -cvzf ../$d.201.tgz * cd .. fi done \ No newline at end of file diff --git a/tivix/favs.json b/tivix/favs.json index 28f4c88..49c92c5 100644 --- a/tivix/favs.json +++ b/tivix/favs.json @@ -1 +1 @@ -[{"id":"385-id_xtra","headline":"ID Xtra","image":"http://tv.tivix.co/uploads/posts/2017-11/1511259092_id-investigation-discovery.png"},{"image":"http://tv.tivix.co/uploads/posts/2018-12/1543639816_yu_tv.png","id":"338-yu-tv","headline":"Ю ТВ"},{"id":"210-nst","headline":"НСТ","image":"http://tv.tivix.co/uploads/posts/2016-04/1461317081_nst.png"}] \ No newline at end of file +[{"id":"385-id_xtra","headline":"ID Xtra","image":"http://tv.tivix.co/uploads/posts/2017-11/1511259092_id-investigation-discovery.png"},{"id":"210-nst","headline":"НСТ","image":"http://tv.tivix.co/uploads/posts/2016-04/1461317081_nst.png"},{"image":"http://tv.tivix.co/uploads/posts/2018-12/1543639816_yu_tv.png","id":"338-yu-tv","headline":"Ю ТВ"}] \ No newline at end of file diff --git a/tivix/main.tengo b/tivix/main.tengo index c0e9384..fe1e263 100644 --- a/tivix/main.tengo +++ b/tivix/main.tengo @@ -45,13 +45,13 @@ if fav { } else { r = [] } // msx answer: -props := srv.player(id, true) +props := srv.settings.player(true) props["trigger:load"] = "execute:service:fetch:" + srv.base_url + "programme.tengo?cid={context:id}" props["control:type"] = "extended" props["progress:type"] = "time:hh:mm" props["label:extension"] = " {ico:msx-white:access-time} {now:time:hh:mm}" props["tizen:display:mode"] = "PLAYER_DISPLAY_MODE_FULL_SCREEN" -opt := (fav ? "Убрать из" : "Добавить в") + " избранные" +opt := fav ? "Убрать из избранных" : "Добавить в избранные" r = jsn.encode({ type: "list", headline: "Tivix", compress: true, items: r, @@ -64,13 +64,15 @@ r = jsn.encode({ imageWidth: 1, imageFiller: "smart", progress: -1, progressColor: "msx-white", titleHeader: "", titleFooter: "", live: {type: "setup", action: "execute:service:fetch:" + srv.base_url + "programme.tengo?cid={context:id}&now=true"}, - properties: props, - options: { - headline: "{context:headline} Меню", - caption: "Меню:{tb}{ico:msx-yellow:stop} " + opt, - template: {enumerate: false, type: "control", layout: "0,0,8,1"}, - items: [{key: "yellow", icon: "msx-yellow:stop", label: opt, action: "execute:fetch:" + srv.base_url + "set.tengo?cid={context:id}" + (fav ? "" : "&ttl={context:headline}&img={context:image}")}] - } + properties: props + }, options: { + headline: "{dic:caption:options|options}:", + caption: "{dic:caption:options|options}:{tb}{ico:msx-yellow:stop} {dic:Up|Up}", + template: {type: "control", layout: "0,0,8,1"}, + items:[ + {key: "yellow", icon: "msx-yellow:stop", label: "{dic:Up|Up}", action: "focus:index:0"}, + {type: "space"}, {icon: "menu", label: "{dic:caption:menu|Menu}", action: "menu"} + ] } }) panic(is_error(r) ? "Encoding playlist error: " + string(r) : undefined) diff --git a/tivix/video.tengo b/tivix/video.tengo index ac1f9e2..b139291 100644 --- a/tivix/video.tengo +++ b/tivix/video.tengo @@ -16,9 +16,7 @@ for i := txt.last_index(b[3], "//"); i > -1; i = txt.last_index(b[3], "//"){ b[3] = import("base64").decode(b[3]) b = txt.replace(txt.replace(txt.replace(b[3], "{v3}", b[2].text, 1), "{v2}", b[1].text, 1), "{v1}", b[0].text, 1) -//srv.log_inf(b) b = "http://" + srv.host + "/proxy.m3u8?header=Referer%3A" + srv.encode_uri(url+"/") + "&header=Origin%3A" + srv.encode_uri(url) + "&link=" + srv.encode_uri(b) //r := srv.request(b, {header: {Referer: url, Origin: txt.trim_suffix(url, "/")}}) //panic(is_error(r) ? r : r.status == 200 ? undefined : r.status) -//srv.log_inf(r.body) -srv.write("{\"response\":{\"status\":200,\"data\":{\"url\":\"", srv.player(srv.read("id"), b), "\"}}}") +srv.write("{\"response\":{\"status\":200,\"data\":{\"url\":\"", txt.trim_prefix(srv.settings.player(b), "video:"), "\"}}}") diff --git a/torlook/magnet.tengo b/torlook/magnet.tengo index 336cb7d..2ba0401 100644 --- a/torlook/magnet.tengo +++ b/torlook/magnet.tengo @@ -12,4 +12,7 @@ u = srv.request(u, {header: {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) Appl panic(is_error(u) ? u : u.status == 200 ? undefined : u.status) u = import("text").re_find("(?s)\" "0.1.142" ? "replace:content:torlook:" : "content:") + srv.base_url + "?find=" +act := (srv.read("v") || "" > "0.1.142" ? "replace:content:torlook:" : "content:") + srv.base_url + "?find=" its := [] stg := srv.memory() -stg = is_array(stg) && len(stg) == 2 ? stg : ["seeders", false] +stg = is_array(stg) && len(stg) == 3 ? stg : ["seeders", false, false] get := func(s, p) { r := srv.request( url + (s ? ("?cinema=on&s=" + srv.encode_uri(s) + "&sort=" + stg[0] + (stg[1] ? "&forced=on" : "")) : "movietop"), @@ -19,32 +19,42 @@ if fnd { if rtn = get(fnd, "(?s)webResult.+?item.+?(.+?).+?(.+?)<.+?class=\"size\">(.+?)<.+?class=\"date\">(.+?)<.+?class=\"arrow-up\".+?>(.+?)<.+?data-src=\"(.+?)\""); is_array(rtn) { for i in rtn { its = append(its, { headline: txt.re_replace("<.+?>", i[1].text, ""), - titleFooter: txt.join([i[3].text, txt.replace(i[4].text, " ", " ", 1), "{ico:calendar-today} " + i[5].text, "{ico:arrow-upward} " + i[6].text], "{tb}{txt:msx-white:|}{tb}"), + titleFooter: i[3].text + "{tb}{ico:msx-white:attach-file}" + txt.replace(i[4].text, " ", " ", 1) + + "{tb}{ico:msx-white:calendar-today} " + i[5].text + "{tb}{ico:msx-white:arrow-upward} " + i[6].text, data: url + srv.encode_uri(i[7].text, true) })} } -} else if rtn = get("", "(?s)webResult.+?item.+?

.+?href=\"/(.+?)\">(.+?)<.+?torstat.+?(.+?)<"); is_array(rtn) { - for i in rtn {its = append(its, {label: i[2].text, extensionLabel: i[5].text, icon: "search", action: act + i[1].text})} +} else if rtn = get("", "(?s)webResult.+?item.+?

.+?href=\"/(.+?)\">(.+?)<.+?(.+?)<"); is_array(rtn) { + for i in rtn {its = append(its, {label: i[2].text, extensionLabel: i[4].text, icon: "search", action: act + i[1].text + "&ttl=" + srv.encode_uri(i[2].text) + ">index:3", data: i[3].text})} } if len(its) == 0 { its = append(its, {icon: "msx-yellow:warning", label: is_string(rtn) ? rtn : "Пусто!", extensionIcon: "msx-white:refresh", action: "reload:content"}) rtn = false } else { - its[0].focus = fnd ? true : false rtn = true } srv.write(jsn.encode({ type: "list", items: its, flag: "torlook", headline: "Torlook", compress: true, - extension: fnd ? ("{ico:search} {col:msx-white}" + fnd) : "{col:msx-white}ТОП 50 (кинопоиск)", - template: {type: "control", layout: "0,0,16," + (rtn && fnd ? "2" : "1"), action: "execute:service:" + srv.base_url + "magnet.tengo"}, + extension: fnd ? ("{ico:search} {col:msx-white}" + fnd) : "{col:msx-white}ТОП-50 (кинопоиск)", + template: { + type: "control", layout: "0,0," + (stg[2] ? "8" : "16") + (rtn && fnd ? ",2" : ",1"), alignment: "title-right", + action: "execute:service:" + srv.base_url + "magnet.tengo?ttl=" + srv.encode_uri(srv.read("ttl") || "") + }, options: { + headline: "{dic:caption:options|options}:", + caption: "{dic:caption:options|options}:{tb}{ico:msx-yellow:stop} {dic:Up|Up}", + template: {type: "control", layout: "0,0,8,1"}, + items:[ + {key: "yellow", icon: "msx-yellow:stop", label: "{dic:Up|Up}", action: "focus:index:1"}, + {type: "space"}, {icon: "menu", label: "{dic:caption:menu|Menu}", action: "menu"} + ] + }, header: {compress: true, items: [ - {type: "space", layout: "1,0,15,1", offset: "-1,0,1,0", color: "msx-black"}, - {type: "button", label: "ТОП 50", action: act, layout: "0,0,2,1"}, + {type: "button", label: "ТОП-50", action: act, layout: "0,0,2,1"}, { type: "control", icon: "search", extensionIcon: "keyboard", layout: "2,0,12,1", label: fnd || "{col:msx-white-soft}Поиск торрентов", focus: fnd ? false : true, action: "execute:http://" + srv.host + "/msx/input", - data: {action: "[back|" + act + "{INPUT}]", headline: "Поиск торрентов", value: fnd, extension: "{ico:search}"} + data: {action: "[back|" + act + "{INPUT}>index:3]", headline: "Поиск торрентов", value: fnd, extension: "Torlook"} }, {type: "button", icon: "settings", iconSize: "small", layout: "14,0,2,1", action: "panel:" + srv.base_url + "settings.tengo"} ]} diff --git a/torlook/settings.tengo b/torlook/settings.tengo index 63d0741..d506eda 100644 --- a/torlook/settings.tengo +++ b/torlook/settings.tengo @@ -1,28 +1,29 @@ srv := import("server") jsn := import("json") stg := srv.memory() -stg = is_array(stg) && len(stg) == 2 ? stg : ["seeders", false] +stg = is_array(stg) && len(stg) == 3 ? stg : ["seeders", false, false] if srv.method == "POST" { if b := jsn.decode(srv.read()); is_map(b) { if is_string(b.data) { stg[0] = b.data } else { - stg[1] = b.data ? true : false - } + stg[b.data ? 1 : 2] = !stg[b.data ? 1 : 2] + } } srv.memory(stg) srv.write(jsn.encode({response: {status: 200, data: {action: "reload:panel"}}})) } else { - srv.write(jsn.encode({ - type: "list", headline: "Параметры поиска", extension: "torlook", reuse: false, cache: false, restore: false, + r := { + type: "list", headline: "Параметры поиска", extension: "Torlook", reuse: false, cache: false, restore: false, template: {type: "control", layout: "0,0,8,1", action: "execute:service:" + srv.base_url + "settings.tengo", enumerate: false}, - items: [ - {icon: "radio-button-" + (stg[0] == "seeders" ? "on" : "off"), label: "сортировать по сидам", data: "seeders"}, - {icon: "radio-button-" + (stg[0] == "size" ? "on" : "off"), label: "сортировать по размеру", data: "size"}, - {icon: "radio-button-" + (stg[0] == "date" ? "on" : "off"), label: "сортировать по дате", data: "date"}, - {icon: "check-box" + (stg[1] ? "" : "-outline-blank"), label: "форсированный поиск", data: !stg[1]}, - {type: "space"}, - {type: "button", label: "Обновить результаты поиска", action: "[back|reload:content]", offset: "2,0,-4,0"} - ] - })) + items: [{icon: "view-list", label: "представление списка", extensionLabel: "{ico:" + (stg[2] ? "" : "msx-white:") + "splitscreen} {ico:msx-white:toggle-o" + (stg[2] ? "n" : "ff") + "} {ico:" + (stg[2] ? "msx-white:" : "") + "grid-view}", data: false}] + } + for s in [["сидам", "seeders"], ["размеру", "size"], ["дате", "date"]] { + r.items = append(r.items, {icon: "sort", label: "сортировать по " + s[0], extensionIcon: stg[0] == s[1] ? "msx-white:radio-button-on" : "radio-button-off", data: s[1]}) + } + r.items = append(r.items, + {icon: "manage-search", label: "форсированный поиск", extensionIcon: stg[1] ? "msx-white:check-box" : "check-box-outline-blank", data: true}, + {type: "button", label: "Обновить результаты поиска", action: "[back|reload:content]", offset: "2,0,-4,0"} + ) + srv.write(jsn.encode(r)) } \ No newline at end of file