修复Jellyfin异常问题
This commit is contained in:
parent
2f1ba2acb9
commit
893afd295c
@ -1,10 +1,12 @@
|
|||||||
package com.yutou.nas.Datas.Jellyfin;
|
package com.yutou.nas.Datas.Jellyfin;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.yutou.nas.utils.AppTools;
|
import com.yutou.nas.utils.AppTools;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ -18,28 +20,28 @@ public class EpisodeData {
|
|||||||
private boolean canDownload;
|
private boolean canDownload;
|
||||||
private String container;
|
private String container;
|
||||||
private String sortName;
|
private String sortName;
|
||||||
private Object[] externalUrls;
|
private JSONArray externalUrls;
|
||||||
private MediaSource[] mediaSources;
|
private List<MediaSource> mediaSources;
|
||||||
private String path;
|
private String path;
|
||||||
private boolean enableMediaSourceDisplay;
|
private boolean enableMediaSourceDisplay;
|
||||||
private Object channelID;
|
private Object channelID;
|
||||||
private Object[] taglines;
|
private JSONArray taglines;
|
||||||
private Object[] genres;
|
private JSONArray genres;
|
||||||
private long runTimeTicks;
|
private long runTimeTicks;
|
||||||
private String playAccess;
|
private String playAccess;
|
||||||
private long parentIndexNumber;
|
private long parentIndexNumber;
|
||||||
private Object[] remoteTrailers;
|
private JSONArray remoteTrailers;
|
||||||
private JSONObject providerIDS;
|
private JSONObject providerIDS;
|
||||||
private boolean isHD;
|
private boolean isHD;
|
||||||
private boolean isFolder;
|
private boolean isFolder;
|
||||||
private String parentID;
|
private String parentID;
|
||||||
private String type;
|
private String type;
|
||||||
private Object[] people;
|
private List<People> people;
|
||||||
private Object[] studios;
|
private List<Studios> studios;
|
||||||
private Object[] genreItems;
|
private JSONArray genreItems;
|
||||||
private String parentLogoItemID;
|
private String parentLogoItemID;
|
||||||
private String parentBackdropItemID;
|
private String parentBackdropItemID;
|
||||||
private String[] parentBackdropImageTags;
|
private JSONArray parentBackdropImageTags;
|
||||||
private long localTrailerCount;
|
private long localTrailerCount;
|
||||||
private UserData userData;
|
private UserData userData;
|
||||||
private String seriesName;
|
private String seriesName;
|
||||||
@ -47,22 +49,22 @@ public class EpisodeData {
|
|||||||
private String seasonID;
|
private String seasonID;
|
||||||
private long specialFeatureCount;
|
private long specialFeatureCount;
|
||||||
private String displayPreferencesID;
|
private String displayPreferencesID;
|
||||||
private Object[] tags;
|
private JSONArray tags;
|
||||||
private double primaryImageAspectRatio;
|
private double primaryImageAspectRatio;
|
||||||
private String seriesPrimaryImageTag;
|
private String seriesPrimaryImageTag;
|
||||||
private String seasonName;
|
private String seasonName;
|
||||||
private MediaStream[] mediaStreams;
|
private List<MediaStream> mediaStreams;
|
||||||
private String videoType;
|
private String videoType;
|
||||||
private ImageTags imageTags;
|
private ImageTags imageTags;
|
||||||
private Object[] backdropImageTags;
|
private JSONArray backdropImageTags;
|
||||||
private Object[] screenshotImageTags;
|
private JSONArray screenshotImageTags;
|
||||||
private String parentLogoImageTag;
|
private String parentLogoImageTag;
|
||||||
private ImageBlurHashes imageBlurHashes;
|
private ImageBlurHashes imageBlurHashes;
|
||||||
private String seriesStudio;
|
private String seriesStudio;
|
||||||
private Chapter[] chapters;
|
private List<Chapter> chapters;
|
||||||
private String locationType;
|
private String locationType;
|
||||||
private String mediaType;
|
private String mediaType;
|
||||||
private Object[] lockedFields;
|
private JSONArray lockedFields;
|
||||||
private boolean lockData;
|
private boolean lockData;
|
||||||
private long width;
|
private long width;
|
||||||
private long height;
|
private long height;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.yutou.nas.Datas.Jellyfin;
|
package com.yutou.nas.Datas.Jellyfin;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
import com.yutou.nas.utils.AppTools;
|
import com.yutou.nas.utils.AppTools;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -17,6 +18,7 @@ public class ItemInfo {
|
|||||||
private String dateLastMediaAdded;
|
private String dateLastMediaAdded;
|
||||||
private String path;
|
private String path;
|
||||||
private String sortName;
|
private String sortName;
|
||||||
|
@JSONField(name = "ParentId")
|
||||||
private String parentID;
|
private String parentID;
|
||||||
private String playAccess;
|
private String playAccess;
|
||||||
private String type;
|
private String type;
|
||||||
|
@ -84,7 +84,7 @@ public class JellyfinAPIManager {
|
|||||||
public List<Episode> getEpisodes(String parentId, String id) {
|
public List<Episode> getEpisodes(String parentId, String id) {
|
||||||
JSONObject json = getEpisodesForJson(parentId, id);
|
JSONObject json = getEpisodesForJson(parentId, id);
|
||||||
JSONArray episodes = json.getJSONArray("Items");
|
JSONArray episodes = json.getJSONArray("Items");
|
||||||
return JSON.parseArray(episodes.toJSONString(), Episode.class);
|
return episodes.toJavaList(Episode.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject getEpisodesDataForJson(String id) {
|
public JSONObject getEpisodesDataForJson(String id) {
|
||||||
@ -95,7 +95,7 @@ public class JellyfinAPIManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public EpisodeData getEpisodeData(String id) {
|
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) {
|
public String getPathForEpisode(String parentId, String id) {
|
||||||
@ -177,12 +177,10 @@ public class JellyfinAPIManager {
|
|||||||
metadata.put("Taglines", new JSONArray());
|
metadata.put("Taglines", new JSONArray());
|
||||||
HashMap<String, String> headers = getHeader();
|
HashMap<String, String> headers = getHeader();
|
||||||
headers.put("Content-Type", "application/json");
|
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()
|
String ret = HttpTools.http_post("http://192.168.31.88:8096/Items/" + item.getId()
|
||||||
, metadata.toString().replace("\"null\"", "null").getBytes(StandardCharsets.UTF_8)
|
, metadata.toString().replace("\"null\"", "null").getBytes(StandardCharsets.UTF_8)
|
||||||
, 4
|
, 4
|
||||||
, headers);
|
, headers);
|
||||||
System.out.println(ret);
|
|
||||||
HttpTools.download(
|
HttpTools.download(
|
||||||
info.getJSONObject("images").getString("large").replace("http:", "https:"),
|
info.getJSONObject("images").getString("large").replace("http:", "https:"),
|
||||||
item.getName() + "_poster.jpg",
|
item.getName() + "_poster.jpg",
|
||||||
@ -330,11 +328,11 @@ public class JellyfinAPIManager {
|
|||||||
public static String mainPath = "Z:\\download\\anim\\";
|
public static String mainPath = "Z:\\download\\anim\\";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
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);
|
//new JellyfinAPIManager().search(file.getName(), file);
|
||||||
JellyfinAPIManager manager = new JellyfinAPIManager();
|
JellyfinAPIManager manager = new JellyfinAPIManager();
|
||||||
// manager.init(file,"325281");
|
manager.init(file,"326895");
|
||||||
JSONArray search = manager.getAnimPaths();
|
// JSONArray search = manager.getAnimPaths();
|
||||||
System.out.println(search);
|
// System.out.println(search);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user