From cf30e6db7c63a34848b5100f602091c08d9510ef Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Mon, 11 Jul 2022 16:58:19 +0800 Subject: [PATCH] =?UTF-8?q?add:=E6=96=B0=E5=A2=9Ejellyfin=E6=90=9C?= =?UTF-8?q?=E5=88=AE=E5=8F=8A=E6=8E=A8=E9=80=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nas/Controllers/JellyfinController.java | 28 +++++++++++++++++++ .../com/yutou/nas/utils/QQBotManager.java | 8 ++++++ 2 files changed, 36 insertions(+) create mode 100644 src/main/java/com/yutou/nas/Controllers/JellyfinController.java diff --git a/src/main/java/com/yutou/nas/Controllers/JellyfinController.java b/src/main/java/com/yutou/nas/Controllers/JellyfinController.java new file mode 100644 index 0000000..2e5906c --- /dev/null +++ b/src/main/java/com/yutou/nas/Controllers/JellyfinController.java @@ -0,0 +1,28 @@ +package com.yutou.nas.Controllers; + +import com.yutou.nas.utils.AppTools; +import com.yutou.nas.utils.QQBotManager; +import com.yutou.nas.utils.StringUtils; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class JellyfinController { + @RequestMapping("/jellyfin/addItem") + @ResponseBody + public String addItem(String Name, String Date) { + if (!StringUtils.isEmpty(Name) && !StringUtils.isEmpty(Date)) { + QQBotManager.getInstance().sendMessage(734332887L, Date + " 新增:" + Name); + AppTools.exec("/public/servier/tinyMediaManager/tinyMediaManager tvshow --scrapeUnscraped", null, false, false); + } + return "ok"; + } + + @ResponseBody + @RequestMapping("/jellyfin/updateMeta") + public String updateMeta() { + AppTools.exec("/public/servier/tinyMediaManager/tinyMediaManager tvshow --scrapeUnscraped", null, false, false); + return "ok"; + } +} diff --git a/src/main/java/com/yutou/nas/utils/QQBotManager.java b/src/main/java/com/yutou/nas/utils/QQBotManager.java index c425299..71a84e2 100644 --- a/src/main/java/com/yutou/nas/utils/QQBotManager.java +++ b/src/main/java/com/yutou/nas/utils/QQBotManager.java @@ -38,6 +38,14 @@ public class QQBotManager { return HttpTools.http_post("http://192.168.31.88:802/qq/send.do", json.toString().getBytes(StandardCharsets.UTF_8), 1, header); } + public String sendMessage(long qq,String text) { + JSONObject json = new JSONObject(); + json.put("qq", qq); + json.put("message",text); + Map header = new HashMap<>(); + header.put("content-type", "application/json"); + return HttpTools.http_post("http://192.168.31.88:802/qq/send.do", json.toString().getBytes(StandardCharsets.UTF_8), 1, header); + } public String sendMessage(String imageUrl, String message) {