更新Jellyfin uid

This commit is contained in:
Yutousama 2022-05-04 00:14:04 +08:00
parent 9bfe05b119
commit 74f7b9cd21

View File

@ -18,6 +18,7 @@ import java.util.*;
public class JellyfinAPIManager { public class JellyfinAPIManager {
private List<LibsItem> mediaItem = new ArrayList<>(); private List<LibsItem> mediaItem = new ArrayList<>();
private static final String userId="389438aeda0a4972ac66a23cbe5c289c";
public JellyfinAPIManager() { public JellyfinAPIManager() {
mediaItem = getAllItem(); mediaItem = getAllItem();
@ -25,7 +26,7 @@ public class JellyfinAPIManager {
public LibsItem getLibs(String key) { public LibsItem getLibs(String key) {
HashMap<String, String> header = getHeader(); HashMap<String, String> 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); JSONObject json = JSON.parseObject(httpText);
if (key == null) { if (key == null) {
return null; return null;
@ -41,12 +42,12 @@ public class JellyfinAPIManager {
} }
public ItemInfo getInfo(String id) { 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); return JSON.parseObject(http, ItemInfo.class);
} }
public List<LibsItem> getAllItem() { public List<LibsItem> 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); JSONObject json = JSON.parseObject(http);
JSONArray items = json.getJSONArray("Items"); JSONArray items = json.getJSONArray("Items");
@ -58,21 +59,21 @@ public class JellyfinAPIManager {
} }
public List<LibsItem> getLibsItems(String id) { public List<LibsItem> 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); JSONObject json = JSON.parseObject(httpText);
JSONArray items = json.getJSONArray("Items"); JSONArray items = json.getJSONArray("Items");
return JSON.parseArray(items.toJSONString(), LibsItem.class); return JSON.parseArray(items.toJSONString(), LibsItem.class);
} }
public JSONObject getItemShows(String id) { 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 id
), getHeader()); ), getHeader());
return JSON.parseObject(data); return JSON.parseObject(data);
} }
public JSONObject getEpisodesForJson(String parentID, String id) { 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, parentID,
id id
), getHeader()); ), getHeader());
@ -86,7 +87,7 @@ public class JellyfinAPIManager {
} }
public JSONObject getEpisodesDataForJson(String id) { 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 id
), getHeader()); ), getHeader());
return JSON.parseObject(data); return JSON.parseObject(data);