diff --git a/pom.xml b/pom.xml index 6bdf711..0e92086 100644 --- a/pom.xml +++ b/pom.xml @@ -69,6 +69,13 @@ fastjson2 2.0.2 + com.jcraft diff --git a/src/main/java/com/yutou/nas/Datas/Jellyfin/ItemInfo.java b/src/main/java/com/yutou/nas/Datas/Jellyfin/ItemInfo.java index cbdf3d7..0118d14 100644 --- a/src/main/java/com/yutou/nas/Datas/Jellyfin/ItemInfo.java +++ b/src/main/java/com/yutou/nas/Datas/Jellyfin/ItemInfo.java @@ -1,9 +1,11 @@ package com.yutou.nas.Datas.Jellyfin; +import com.alibaba.fastjson2.JSONArray; import com.yutou.nas.utils.AppTools; import lombok.Data; import java.io.File; +import java.util.List; @Data public class ItemInfo { @@ -13,38 +15,37 @@ public class ItemInfo { private String etag; private String dateCreated; private String dateLastMediaAdded; - private boolean canDelete; - private boolean canDownload; - private String sortName; - private Object[] externalUrls; private String path; - private boolean enableMediaSourceDisplay; - private Object channelID; - private Object[] taglines; - private Object[] genres; - private String playAccess; - private Object[] remoteTrailers; - private boolean isFolder; + private String sortName; private String parentID; + private String playAccess; private String type; - private Object[] people; - private Object[] studios; - private Object[] genreItems; + private String displayPreferencesID; + private String locationType; private long localTrailerCount; - private UserData userData; private long recursiveItemCount; private long childCount; private long specialFeatureCount; - private String displayPreferencesID; - private Object[] airDays; - private Object[] tags; - private double primaryImageAspectRatio; - private ImageTags imageTags; - private String[] backdropImageTags; - private Object[] screenshotImageTags; - private String locationType; - private Object[] lockedFields; + private boolean canDownload; + private boolean canDelete; + private boolean enableMediaSourceDisplay; + private boolean isFolder; private boolean lockData; + private double primaryImageAspectRatio; + private Object channelID; + + private Object[] externalUrls; + private Object[] remoteTrailers; + private Object[] genreItems; + private Object[] airDays; + private Object[] screenshotImageTags; + private Object[] lockedFields; + private List studios; + private List people; + private JSONArray backdropImageTags; + private JSONArray genres; + private JSONArray taglines; + private JSONArray tags; public String getPath() { if (AppTools.isRuntimeSystemOfWindow()) { diff --git a/src/main/java/com/yutou/nas/Datas/Jellyfin/People.java b/src/main/java/com/yutou/nas/Datas/Jellyfin/People.java new file mode 100644 index 0000000..450d19b --- /dev/null +++ b/src/main/java/com/yutou/nas/Datas/Jellyfin/People.java @@ -0,0 +1,11 @@ +package com.yutou.nas.Datas.Jellyfin; + +import lombok.Data; + +@Data +public class People { + private String name; + private String id; + private String role; + private String type; +} diff --git a/src/main/java/com/yutou/nas/Datas/Jellyfin/Studios.java b/src/main/java/com/yutou/nas/Datas/Jellyfin/Studios.java new file mode 100644 index 0000000..fed7e70 --- /dev/null +++ b/src/main/java/com/yutou/nas/Datas/Jellyfin/Studios.java @@ -0,0 +1,9 @@ +package com.yutou.nas.Datas.Jellyfin; + +import lombok.Data; + +@Data +public class Studios { + private String id; + private String name; +} diff --git a/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java b/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java index 07379ec..b8bec3a 100644 --- a/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java +++ b/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java @@ -44,7 +44,7 @@ public class JellyfinAPIManager { public ItemInfo getInfo(String id) { 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).toJavaObject(ItemInfo.class); } public List getAllItem() { @@ -52,7 +52,7 @@ public class JellyfinAPIManager { JSONObject json = JSON.parseObject(http); JSONArray items = json.getJSONArray("Items"); - List list = JSON.parseArray(items.toJSONString(), LibsItem.class); + List list =items.toJavaList(LibsItem.class); for (LibsItem item : list) { item.setInfo(getInfo(item.getId())); } @@ -63,7 +63,7 @@ public class JellyfinAPIManager { 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); + return items.toJavaList(LibsItem.class); } public JSONObject getItemShows(String id) { @@ -333,8 +333,8 @@ public class JellyfinAPIManager { File file = new File("Z:\\download\\anim\\白沙的水族馆"); //new JellyfinAPIManager().search(file.getName(), file); JellyfinAPIManager manager = new JellyfinAPIManager(); - manager.init(file,"325281"); - //JSONArray search = manager.getAnimPaths(); - //System.out.println(search); + // manager.init(file,"325281"); + JSONArray search = manager.getAnimPaths(); + System.out.println(search); } }