修复Jellyfin异常问题

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

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