add:新增jellyfin搜刮及推送功能

This commit is contained in:
Yutousama 2022-07-11 16:58:19 +08:00
parent e090e6375e
commit cf30e6db7c
2 changed files with 36 additions and 0 deletions

View File

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

View File

@ -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<String, String> 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) {