From ca06eed5162783fb3347a410ad4cc738455cfce8 Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Wed, 20 Jul 2022 14:33:21 +0800 Subject: [PATCH] =?UTF-8?q?update:=E8=A7=A6=E5=8F=91=E6=90=9C=E5=88=AE?= =?UTF-8?q?=E5=99=A8=E5=90=8E=E6=9B=B4=E6=96=B0jellyfin=E5=85=83=E7=B4=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yutou/nas/Controllers/JellyfinController.java | 3 +++ src/main/java/com/yutou/nas/utils/HttpTools.java | 3 +++ src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/src/main/java/com/yutou/nas/Controllers/JellyfinController.java b/src/main/java/com/yutou/nas/Controllers/JellyfinController.java index 3653695..b405721 100644 --- a/src/main/java/com/yutou/nas/Controllers/JellyfinController.java +++ b/src/main/java/com/yutou/nas/Controllers/JellyfinController.java @@ -1,6 +1,7 @@ package com.yutou.nas.Controllers; import com.yutou.nas.utils.AppTools; +import com.yutou.nas.utils.JellyfinAPIManager; import com.yutou.nas.utils.QQBotManager; import com.yutou.nas.utils.StringUtils; import org.springframework.stereotype.Controller; @@ -15,6 +16,7 @@ public class JellyfinController { if (!StringUtils.isEmpty(Name) && !StringUtils.isEmpty(Date)) { QQBotManager.getInstance().sendMessage(734332887L, " 新增:" + Name); AppTools.exec("/home/yutou/public/servier/tinyMediaManager/tinyMediaManager tvshow -u --scrapeUnscraped", null, false, true); + new JellyfinAPIManager().refresh(); } return "ok"; } @@ -23,6 +25,7 @@ public class JellyfinController { @RequestMapping("/jellyfin/updateMeta") public String updateMeta() { AppTools.exec("/home/yutou/public/servier/tinyMediaManager/tinyMediaManager tvshow -u --scrapeUnscraped", null, false, true); + new JellyfinAPIManager().refresh(); return "ok"; } } diff --git a/src/main/java/com/yutou/nas/utils/HttpTools.java b/src/main/java/com/yutou/nas/utils/HttpTools.java index ebeb7d3..ec2a2a1 100644 --- a/src/main/java/com/yutou/nas/utils/HttpTools.java +++ b/src/main/java/com/yutou/nas/utils/HttpTools.java @@ -64,6 +64,9 @@ public class HttpTools { connection.addRequestProperty(key, headers.get(key)); } } + if(body==null){ + body="".getBytes(); + } connection.setDoOutput(true); connection.setDoInput(true); connection.addRequestProperty("User-Agent", getUa()); diff --git a/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java b/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java index 6478998..1f47741 100644 --- a/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java +++ b/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java @@ -279,6 +279,11 @@ public class JellyfinAPIManager { } return array; } + public void refresh(){ + String url="http://192.168.31.88:8096/Items/28e774baf8f2fd279e7d58da9890a7d2/Refresh?Recursive=true&ImageRefreshMode=FullRefresh&MetadataRefreshMode=FullRefresh&ReplaceAllImages=false&ReplaceAllMetadata=true"; + String tmp=HttpTools.http_post(url,null,1,getHeader()); + System.out.println(tmp); + } public void init(File path,String id) { if (id != null) {