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); }