新增动画元数据设置
移动部分页面导航
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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<String> 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("=");
|
||||
|
||||
Reference in New Issue
Block a user