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) {