From 2f1ba2acb97c30913888a62597e94da291b32ab7 Mon Sep 17 00:00:00 2001
From: Yutousama <583819556@qq.com>
Date: Wed, 4 May 2022 10:58:17 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DJellyfin=E5=BC=82=E5=B8=B8?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 7 +++
.../yutou/nas/Datas/Jellyfin/ItemInfo.java | 49 ++++++++++---------
.../com/yutou/nas/Datas/Jellyfin/People.java | 11 +++++
.../com/yutou/nas/Datas/Jellyfin/Studios.java | 9 ++++
.../yutou/nas/utils/JellyfinAPIManager.java | 12 ++---
5 files changed, 58 insertions(+), 30 deletions(-)
create mode 100644 src/main/java/com/yutou/nas/Datas/Jellyfin/People.java
create mode 100644 src/main/java/com/yutou/nas/Datas/Jellyfin/Studios.java
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);
}
}