修复Jellyfin异常问题

This commit is contained in:
Yutousama 2022-05-04 11:24:40 +08:00
parent 2f1ba2acb9
commit 893afd295c
3 changed files with 25 additions and 23 deletions

View File

@ -1,10 +1,12 @@
package com.yutou.nas.Datas.Jellyfin;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.yutou.nas.utils.AppTools;
import lombok.Data;
import java.io.File;
import java.util.List;
@Data
@ -18,28 +20,28 @@ public class EpisodeData {
private boolean canDownload;
private String container;
private String sortName;
private Object[] externalUrls;
private MediaSource[] mediaSources;
private JSONArray externalUrls;
private List<MediaSource> mediaSources;
private String path;
private boolean enableMediaSourceDisplay;
private Object channelID;
private Object[] taglines;
private Object[] genres;
private JSONArray taglines;
private JSONArray genres;
private long runTimeTicks;
private String playAccess;
private long parentIndexNumber;
private Object[] remoteTrailers;
private JSONArray remoteTrailers;
private JSONObject providerIDS;
private boolean isHD;
private boolean isFolder;
private String parentID;
private String type;
private Object[] people;
private Object[] studios;
private Object[] genreItems;
private List<People> people;
private List<Studios> studios;
private JSONArray genreItems;
private String parentLogoItemID;
private String parentBackdropItemID;
private String[] parentBackdropImageTags;
private JSONArray parentBackdropImageTags;
private long localTrailerCount;
private UserData userData;
private String seriesName;
@ -47,22 +49,22 @@ public class EpisodeData {
private String seasonID;
private long specialFeatureCount;
private String displayPreferencesID;
private Object[] tags;
private JSONArray tags;
private double primaryImageAspectRatio;
private String seriesPrimaryImageTag;
private String seasonName;
private MediaStream[] mediaStreams;
private List<MediaStream> mediaStreams;
private String videoType;
private ImageTags imageTags;
private Object[] backdropImageTags;
private Object[] screenshotImageTags;
private JSONArray backdropImageTags;
private JSONArray screenshotImageTags;
private String parentLogoImageTag;
private ImageBlurHashes imageBlurHashes;
private String seriesStudio;
private Chapter[] chapters;
private List<Chapter> chapters;
private String locationType;
private String mediaType;
private Object[] lockedFields;
private JSONArray lockedFields;
private boolean lockData;
private long width;
private long height;

View File

@ -1,6 +1,7 @@
package com.yutou.nas.Datas.Jellyfin;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.annotation.JSONField;
import com.yutou.nas.utils.AppTools;
import lombok.Data;
@ -17,6 +18,7 @@ public class ItemInfo {
private String dateLastMediaAdded;
private String path;
private String sortName;
@JSONField(name = "ParentId")
private String parentID;
private String playAccess;
private String type;

View File

@ -84,7 +84,7 @@ public class JellyfinAPIManager {
public List<Episode> getEpisodes(String parentId, String id) {
JSONObject json = getEpisodesForJson(parentId, id);
JSONArray episodes = json.getJSONArray("Items");
return JSON.parseArray(episodes.toJSONString(), Episode.class);
return episodes.toJavaList(Episode.class);
}
public JSONObject getEpisodesDataForJson(String id) {
@ -95,7 +95,7 @@ public class JellyfinAPIManager {
}
public EpisodeData getEpisodeData(String id) {
return JSON.parseObject(getEpisodesDataForJson(id).toString(), EpisodeData.class);
return getEpisodesDataForJson(id).toJavaObject(EpisodeData.class);
}
public String getPathForEpisode(String parentId, String id) {
@ -177,12 +177,10 @@ public class JellyfinAPIManager {
metadata.put("Taglines", new JSONArray());
HashMap<String, String> headers = getHeader();
headers.put("Content-Type", "application/json");
System.out.println(metadata.toString().replace("\"null\"", "null"));
String ret = HttpTools.http_post("http://192.168.31.88:8096/Items/" + item.getId()
, metadata.toString().replace("\"null\"", "null").getBytes(StandardCharsets.UTF_8)
, 4
, headers);
System.out.println(ret);
HttpTools.download(
info.getJSONObject("images").getString("large").replace("http:", "https:"),
item.getName() + "_poster.jpg",
@ -330,11 +328,11 @@ public class JellyfinAPIManager {
public static String mainPath = "Z:\\download\\anim\\";
public static void main(String[] args) {
File file = new File("Z:\\download\\anim\\白沙的水族馆");
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,"326895");
// JSONArray search = manager.getAnimPaths();
// System.out.println(search);
}
}