From 74f7b9cd2176e983c709c63bceeff7c0b844fe5d Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Wed, 4 May 2022 00:14:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0Jellyfin=20uid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yutou/nas/utils/JellyfinAPIManager.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java b/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java index b85ab5e..584872d 100644 --- a/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java +++ b/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java @@ -18,6 +18,7 @@ import java.util.*; public class JellyfinAPIManager { private List mediaItem = new ArrayList<>(); + private static final String userId="389438aeda0a4972ac66a23cbe5c289c"; public JellyfinAPIManager() { mediaItem = getAllItem(); @@ -25,7 +26,7 @@ public class JellyfinAPIManager { public LibsItem getLibs(String key) { HashMap header = getHeader(); - String httpText = HttpTools.https_get("http://192.168.31.88:8096/Users/e8a13675bb64466dbd81f1e5985ef8c7/Items", header); + String httpText = HttpTools.https_get("http://192.168.31.88:8096/Users/"+userId+"/Items", header); JSONObject json = JSON.parseObject(httpText); if (key == null) { return null; @@ -41,12 +42,12 @@ public class JellyfinAPIManager { } public ItemInfo getInfo(String id) { - String http = HttpTools.https_get("http://192.168.31.88:8096/Users/e8a13675bb64466dbd81f1e5985ef8c7/Items/" + id, getHeader()); + String http = HttpTools.https_get("http://192.168.31.88:8096/Users/"+userId+"/Items/" + id, getHeader()); return JSON.parseObject(http, ItemInfo.class); } public List getAllItem() { - String http = HttpTools.https_get("http://192.168.31.88:8096/Users/e8a13675bb64466dbd81f1e5985ef8c7/Items?SortBy=SortName&SortOrder=Ascending&IncludeItemTypes=Series&Recursive=true&Fields=PrimaryImageAspectRatio%2CBasicSyncInfo&ImageTypeLimit=1&EnableImageTypes=Primary%2CBackdrop%2CBanner%2CThumb&ParentId=28e774baf8f2fd279e7d58da9890a7d2", getHeader()); + String http = HttpTools.https_get("http://192.168.31.88:8096/Users/"+userId+"/Items?SortBy=SortName&SortOrder=Ascending&IncludeItemTypes=Series&Recursive=true&Fields=PrimaryImageAspectRatio%2CBasicSyncInfo&ImageTypeLimit=1&EnableImageTypes=Primary%2CBackdrop%2CBanner%2CThumb&ParentId=28e774baf8f2fd279e7d58da9890a7d2", getHeader()); JSONObject json = JSON.parseObject(http); JSONArray items = json.getJSONArray("Items"); @@ -58,21 +59,21 @@ public class JellyfinAPIManager { } public List getLibsItems(String id) { - String httpText = HttpTools.https_get("http://192.168.31.88:8096/Users/e8a13675bb64466dbd81f1e5985ef8c7/Items?ParentId=" + id, getHeader()); + String httpText = HttpTools.https_get("http://192.168.31.88:8096/Users/"+userId+"/Items?ParentId=" + id, getHeader()); JSONObject json = JSON.parseObject(httpText); JSONArray items = json.getJSONArray("Items"); return JSON.parseArray(items.toJSONString(), LibsItem.class); } public JSONObject getItemShows(String id) { - String data = HttpTools.https_get(String.format("http://192.168.31.88:8096/Shows/%s/Seasons?userId=e8a13675bb64466dbd81f1e5985ef8c7", + String data = HttpTools.https_get(String.format("http://192.168.31.88:8096/Shows/%s/Seasons?userId="+userId+"", id ), getHeader()); return JSON.parseObject(data); } public JSONObject getEpisodesForJson(String parentID, String id) { - String data = HttpTools.https_get(String.format("http://192.168.31.88:8096/Shows/%s/Episodes?seasonId=%s&userId=e8a13675bb64466dbd81f1e5985ef8c7", + String data = HttpTools.https_get(String.format("http://192.168.31.88:8096/Shows/%s/Episodes?seasonId=%s&userId="+userId+"", parentID, id ), getHeader()); @@ -86,7 +87,7 @@ public class JellyfinAPIManager { } public JSONObject getEpisodesDataForJson(String id) { - String data = HttpTools.https_get(String.format("http://192.168.31.88:8096/Users/e8a13675bb64466dbd81f1e5985ef8c7/Items/%s", + String data = HttpTools.https_get(String.format("http://192.168.31.88:8096/Users/"+userId+"/Items/%s", id ), getHeader()); return JSON.parseObject(data);