修复Jellyfin异常问题

This commit is contained in:
Yutousama 2022-05-04 10:58:17 +08:00
parent 51c15f4a34
commit 2f1ba2acb9
5 changed files with 58 additions and 30 deletions

View File

@ -69,6 +69,13 @@
<artifactId>fastjson2</artifactId>
<version>2.0.2</version>
</dependency>
<!-- <dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>2.0.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/fastjson2-2.0.3.jar</systemPath>
</dependency>-->
<!-- https://mvnrepository.com/artifact/com.jcraft/jsch -->
<dependency>
<groupId>com.jcraft</groupId>

View File

@ -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> studios;
private List<People> people;
private JSONArray backdropImageTags;
private JSONArray genres;
private JSONArray taglines;
private JSONArray tags;
public String getPath() {
if (AppTools.isRuntimeSystemOfWindow()) {

View File

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

View File

@ -0,0 +1,9 @@
package com.yutou.nas.Datas.Jellyfin;
import lombok.Data;
@Data
public class Studios {
private String id;
private String name;
}

View File

@ -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<LibsItem> getAllItem() {
@ -52,7 +52,7 @@ public class JellyfinAPIManager {
JSONObject json = JSON.parseObject(http);
JSONArray items = json.getJSONArray("Items");
List<LibsItem> list = JSON.parseArray(items.toJSONString(), LibsItem.class);
List<LibsItem> 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);
}
}