新增动画元数据设置

移动部分页面导航
This commit is contained in:
Yutousama 2022-04-02 23:31:26 +08:00
parent 690de202ae
commit ab49b9400b
8 changed files with 135 additions and 10 deletions

View File

@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication @SpringBootApplication
public class ToolsApplication { 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) { public static void main(String[] args) {
System.out.println("当前版本号:" + version); System.out.println("当前版本号:" + version);

View File

@ -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;
}
}

View File

@ -10,6 +10,7 @@ import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Map; import java.util.Map;
import java.util.Set; 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)"; 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(); StringBuilder string = new StringBuilder();
Set<String> keys = json.keySet(); Set<String> keys = json.keySet();
for (String key : keys) { for (String key : keys) {
try { 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
try { try {
string.append("&").append(URLEncoder.encode(key, "UTF-8")).append("="); string.append("&").append(URLEncoder.encode(key, StandardCharsets.UTF_8)).append("=");
// string += "&" + key + "="; // string += "&" + key + "=";
} catch (Exception e1) { } catch (Exception e1) {
string.append("&").append(key).append("="); string.append("&").append(key).append("=");

1
web/css/my.css Normal file
View File

@ -0,0 +1 @@
.mybody{left: 200px;overflow:auto;}

View File

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>动画元数据设置</title>
<link rel="stylesheet" href="/layui/css/layui.css">
</head>
<body>
<div class="layui-layout layui-layout-admin">
<div id="header"></div>
<div class="layui-body mybody">
<div id="side"></div>
<div id="animmeta"></div>
<div id="footer"></div>
</div>
</div>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
<script>
$('#header').load("/html/header.html");
$('#footer').load("/html/footer.html");
var loadId = layer.load();
$.get('/anim/meta/get.do', function (json) {
layer.close(loadId)
layui.use('tree', function () {
var tree = layui.tree;
tree.render({
elem: '#animmeta',
data: json,
click: function (obj) {
var url="https://bgm.tv/subject_search/"+encodeURIComponent(obj.data.title)+"?cat=2"
layer.prompt({
title: "设置元数据:"+'<a href='+url+' target="_blank">查询</a>',
value: ''
}, function (value, index, elem) {
loadId=layer.load()
$.post('/anim/meta/set.do',{path:obj.data.id,id:value},function(data){
layer.close(loadId);
layer.msg("设置成功")
layer.close(index);
})
})
}
})
})
})
</script>
<style>
#icon {
float: right;
}
.body {
bottom: 0;
}
</style>
</body>
</html>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="ch">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
@ -22,7 +22,7 @@
<script> <script>
$.get("/login/check.do", function (data) { $.get("/login/check.do", function (data) {
let json = JSON.parse(data); let json = JSON.parse(data);
if (json.code != 0) { if (json.code !== 0) {
window.location.href = "/" window.location.href = "/"
} }
}) })

View File

@ -11,7 +11,7 @@
<div class="layui-layout layui-layout-admin"> <div class="layui-layout layui-layout-admin">
<div id="header"></div> <div id="header"></div>
<div class="layui-body" style="left: 200px;overflow:auto;"> <div class="layui-body mybody">
<!-- <div id="side"></div>--> <!-- <div id="side"></div>-->
<div style="margin-left: 2%; margin-top: 2%;"> <div style="margin-left: 2%; margin-top: 2%;">

View File

@ -6,6 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Title</title> <title>Title</title>
<link rel="stylesheet" href="/layui/css/layui.css"> <link rel="stylesheet" href="/layui/css/layui.css">
<link rel="stylesheet" href="/css/my.css">
</head> </head>
<body> <body>
@ -26,6 +27,10 @@
<dd><a href="/html/body/tools/clash.html">管理Clash</a></dd> <dd><a href="/html/body/tools/clash.html">管理Clash</a></dd>
<dd><a href="/html/body/tools/password.html">密码管理器</a></dd> <dd><a href="/html/body/tools/password.html">密码管理器</a></dd>
<dd><a href="javascript:;" id="open_pc">远程开机</a></dd> <dd><a href="javascript:;" id="open_pc">远程开机</a></dd>
<dd><a href="/html/body/nas/cctv.html">监控</a></dd>
<dd><a href="/html/body/nas/animrss.html">动画RSS</a></dd>
<dd><a href="/html/body/nas/animMeta.html">动画元数据设置</a></dd>
<dd><a href="/html/body/nas/oss.html">OSS备份设置</a></dd>
</dl> </dl>
</li> </li>
<li class="layui-nav-item"> <li class="layui-nav-item">
@ -35,9 +40,6 @@
<dd><a href="http://bt.yutou233.cn" target="_blank">BT下载</a></dd> <dd><a href="http://bt.yutou233.cn" target="_blank">BT下载</a></dd>
<dd><a href="http://jellyfin.yutou233.cn:7800/" target="_blank">jellyfin</a></dd> <dd><a href="http://jellyfin.yutou233.cn:7800/" target="_blank">jellyfin</a></dd>
<dd><a href="/html/body/nas/music.html">NAS音乐播放器</a></dd> <dd><a href="/html/body/nas/music.html">NAS音乐播放器</a></dd>
<dd><a href="/html/body/nas/cctv.html">监控</a></dd>
<dd><a href="/html/body/nas/animrss.html">动画RSS</a></dd>
<dd><a href="/html/body/nas/oss.html">OSS备份设置</a></dd>
</dl> </dl>
</li> </li>
<li class="layui-nav-item" id='icon'> <li class="layui-nav-item" id='icon'>