From 3997ee91acf718bb0ef1d1970c6d469ce7bbc2fd Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Sat, 2 Jul 2022 12:26:13 +0800 Subject: [PATCH] =?UTF-8?q?jellyfin:=E4=BF=AE=E5=A4=8D=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yutou/nas/utils/JellyfinAPIManager.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java b/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java index 6340500..6478998 100644 --- a/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java +++ b/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java @@ -111,7 +111,7 @@ public class JellyfinAPIManager { public void uploadImage(File image, String id, String model) { try { HashMap header = getHeader(); - header.put("Content-Type", "image/jpg"); + header.put("Content-Type", "image/jpeg"); String url = String.format("http://192.168.31.88:8096/Items/%s/Images/%s", id, model @@ -203,7 +203,7 @@ public class JellyfinAPIManager { public HashMap getHeader() { HashMap header = new HashMap<>(); - header.put("X-Emby-Authorization", "MediaBrowser Client=\"Jellyfin CLI\", Device=\"Jellyfin-CLI\", DeviceId=\"None\", Version=\"10.7.6\", Token=\""+token+"\""); + header.put("X-Emby-Authorization", "MediaBrowser Client=\"Jellyfin Web\", Device=\"Chrome\", DeviceId=\"TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzg2LjAuNDI0MC43NSBTYWZhcmkvNTM3LjM2fDE2MDI4NDYzMDc5NjE1\", Version=\"10.8.1\",Token=\""+token+"\""); return header; } @@ -330,13 +330,7 @@ public class JellyfinAPIManager { public void login(){ String url="http://192.168.31.88:8096/Users/authenticatebyname"; - Map header = new HashMap<>(); - header.put("content-type", "application/json"); - header.put("accept", "application/json"); - header.put("Connection", "keep-alive"); - header.put("User-Agent", HttpTools.getUa()); - header.put("Origin", "http://192.168.31.88:8096"); - header.put("X-Emby-Authorization", "MediaBrowser Client=\"Jellyfin Web\", Device=\"Chrome\", DeviceId=\"TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzg2LjAuNDI0MC43NSBTYWZhcmkvNTM3LjM2fDE2MDI4NDYzMDc5NjE1\", Version=\"10.8.1\""); + HashMap header=getHttpHeader(); JSONObject json=new JSONObject(); json.put("Pw","34864394"); json.put("Username","home"); @@ -345,12 +339,22 @@ public class JellyfinAPIManager { token=json.getString("AccessToken"); userId=json.getJSONObject("User").getString("Id"); } + private HashMap getHttpHeader(){ + HashMap header = new HashMap<>(); + header.put("content-type", "application/json"); + header.put("accept", "application/json"); + header.put("Connection", "keep-alive"); + header.put("User-Agent", HttpTools.getUa()); + header.put("Origin", "http://192.168.31.88:8096"); + header.put("X-Emby-Authorization", "MediaBrowser Client=\"Jellyfin Web\", Device=\"Chrome\", DeviceId=\"TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzg2LjAuNDI0MC43NSBTYWZhcmkvNTM3LjM2fDE2MDI4NDYzMDc5NjE1\", Version=\"10.8.1\""); + return header; + } public static void main(String[] args) { - File file = new File("Z:\\download\\anim\\夏日重现"); + File file = new File("Z:\\download\\anim\\神渣☆偶像"); //new JellyfinAPIManager().search(file.getName(), file); JellyfinAPIManager manager = new JellyfinAPIManager(); - manager.init(file,"326895"); + manager.init(file,"359985"); // JSONArray search = manager.getAnimPaths(); // System.out.println(search); }