From ab49b9400b79696e654f66a3ebe15bf729ac1475 Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Sat, 2 Apr 2022 23:31:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=A8=E7=94=BB=E5=85=83?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=AE=BE=E7=BD=AE=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E9=83=A8=E5=88=86=E9=A1=B5=E9=9D=A2=E5=AF=BC=E8=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yutou/tools/ToolsApplication.java | 2 +- .../tools/bangumi/AnimMetaController.java | 57 +++++++++++++++++ .../java/com/yutou/tools/utils/HttpTools.java | 7 +- web/css/my.css | 1 + web/html/body/nas/animMeta.html | 64 +++++++++++++++++++ web/html/body/nas/ip.html | 4 +- web/html/body/nas/music.html | 2 +- web/html/header.html | 8 ++- 8 files changed, 135 insertions(+), 10 deletions(-) create mode 100644 src/main/java/com/yutou/tools/bangumi/AnimMetaController.java create mode 100644 web/css/my.css create mode 100644 web/html/body/nas/animMeta.html diff --git a/src/main/java/com/yutou/tools/ToolsApplication.java b/src/main/java/com/yutou/tools/ToolsApplication.java index c1b6367..6804134 100644 --- a/src/main/java/com/yutou/tools/ToolsApplication.java +++ b/src/main/java/com/yutou/tools/ToolsApplication.java @@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ToolsApplication { - public static final String version="1.4.4.6"; + public static final String version="1.4.5"; public static void main(String[] args) { System.out.println("当前版本号:" + version); diff --git a/src/main/java/com/yutou/tools/bangumi/AnimMetaController.java b/src/main/java/com/yutou/tools/bangumi/AnimMetaController.java new file mode 100644 index 0000000..42081fd --- /dev/null +++ b/src/main/java/com/yutou/tools/bangumi/AnimMetaController.java @@ -0,0 +1,57 @@ +package com.yutou.tools.bangumi; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.yutou.tools.nas.UpdateIp; +import com.yutou.tools.utils.HttpTools; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.nio.charset.StandardCharsets; + +@Controller +public class AnimMetaController { + @RequestMapping("/anim/meta/get.do") + @ResponseBody + public JSONArray getAnimMeta() { + String ret = HttpTools.get("http://" + UpdateIp.nas_ip + ":8000/tools/anim/items.do"); + JSONArray array = new JSONArray(); + if (ret != null) { + JSONArray metas = JSONArray.parseArray(ret); + for (Object _meta : metas) { + JSONObject meta = (JSONObject) _meta; + JSONObject item = new JSONObject(); + item.put("title", meta.getString("name")); + item.put("id", meta.getString("root")); + if (meta.getInteger("size") > 1) { + JSONArray _tmp = new JSONArray(); + for (Object _path : meta.getJSONArray("path")) { + JSONObject children = new JSONObject(); + JSONObject path = (JSONObject) _path; + children.put("title", path.getString("name")); + children.put("id", path.getString("path") == null ? meta.getString("root") : path.getString("path")); + _tmp.add(children); + item.put("children", _tmp); + } + } + array.add(item); + } + } + return array; + } + + @ResponseBody + @RequestMapping(value = "/anim/meta/set.do", method = RequestMethod.POST) + public JSONObject setAnimMeta(String path, String id) { + JSONObject item = new JSONObject(); + item.put("path", path); + item.put("id", id); + String ret = HttpTools.post("http://" + UpdateIp.nas_ip + ":8000/tools/anim/set.do", HttpTools.toUrlParams(item).getBytes(StandardCharsets.UTF_8)); + JSONObject json = new JSONObject(); + json.put("code", 0); + json.put("msg", ret); + return json; + } +} diff --git a/src/main/java/com/yutou/tools/utils/HttpTools.java b/src/main/java/com/yutou/tools/utils/HttpTools.java index 445cf01..ad8e603 100644 --- a/src/main/java/com/yutou/tools/utils/HttpTools.java +++ b/src/main/java/com/yutou/tools/utils/HttpTools.java @@ -10,6 +10,7 @@ import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.Set; @@ -109,16 +110,16 @@ public class HttpTools { return "/KUKU_APP(Android/#/cn.kuku.sdk/ttsdk17228/29401/A-2.9.4.01.KUSDK/868139039134314/fcddf839c8c135fa/F4:60:E2:AB:25:1A/460019406520644/+8618569400341/#/9/Redmi 6 Pro/xiaomi/1736/76fda4d6-cd6b-485f-987b-8d347b007f24/#/KUKU/Native/92972ea9651fbd2e)"; } - public String toUrlParams(JSONObject json) { + public static String toUrlParams(JSONObject json) { StringBuilder string = new StringBuilder(); Set keys = json.keySet(); for (String key : keys) { try { - string.append("&").append(key).append("=").append(URLEncoder.encode(json.getString(key), "UTF-8")); + string.append("&").append(key).append("=").append(URLEncoder.encode(json.getString(key), StandardCharsets.UTF_8)); } catch (Exception e) { e.printStackTrace(); try { - string.append("&").append(URLEncoder.encode(key, "UTF-8")).append("="); + string.append("&").append(URLEncoder.encode(key, StandardCharsets.UTF_8)).append("="); // string += "&" + key + "="; } catch (Exception e1) { string.append("&").append(key).append("="); diff --git a/web/css/my.css b/web/css/my.css new file mode 100644 index 0000000..c9e45bc --- /dev/null +++ b/web/css/my.css @@ -0,0 +1 @@ +.mybody{left: 200px;overflow:auto;} \ No newline at end of file diff --git a/web/html/body/nas/animMeta.html b/web/html/body/nas/animMeta.html new file mode 100644 index 0000000..65e4e93 --- /dev/null +++ b/web/html/body/nas/animMeta.html @@ -0,0 +1,64 @@ + + + + + + + 动画元数据设置 + + + + +
+ +
+
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/web/html/body/nas/ip.html b/web/html/body/nas/ip.html index 9c88630..c78efcc 100644 --- a/web/html/body/nas/ip.html +++ b/web/html/body/nas/ip.html @@ -1,5 +1,5 @@ - + @@ -22,7 +22,7 @@