修复fastjson的代码
This commit is contained in:
parent
4bcf56207d
commit
9bfe05b119
4
pom.xml
4
pom.xml
@ -65,8 +65,8 @@
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
<version>2.0.2</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.jcraft/jsch -->
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.yutou.nas.Controllers;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.utils.RedisTools;
|
||||
import com.yutou.nas.utils.StringUtils;
|
||||
import com.yutou.nas.utils.Tools;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.yutou.nas.Controllers;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.utils.QQBotManager;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -1,7 +1,8 @@
|
||||
package com.yutou.nas.Controllers;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.Services.impl.MusicToolsServiceImpl;
|
||||
import com.yutou.nas.mybatis.model.MusicData;
|
||||
import com.yutou.nas.utils.ConfigTools;
|
||||
@ -37,7 +38,7 @@ public class MusicController {
|
||||
json.put("code", 0);
|
||||
json.put("scan", musicTools.isScan());
|
||||
json.put("size", musicTools.getLength());
|
||||
json.put("data", JSONArray.toJSON(musicTools.getMusicList(true)));
|
||||
json.put("data", JSON.toJSON(musicTools.getMusicList(true)));
|
||||
return json.toJSONString();
|
||||
}
|
||||
|
||||
@ -59,7 +60,7 @@ public class MusicController {
|
||||
json.put("code", 0);
|
||||
json.put("scan", musicTools.isScan());
|
||||
json.put("size", musicTools.getLength());
|
||||
json.put("data", JSONArray.toJSON(musicTools.getPath(path, type, true)));
|
||||
json.put("data", JSON.toJSON(musicTools.getPath(path, type, true)));
|
||||
return json.toJSONString();
|
||||
}
|
||||
|
||||
@ -70,9 +71,9 @@ public class MusicController {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", 0);
|
||||
if (StringUtils.isEmpty(album)) {
|
||||
json.put("data", JSONArray.toJSON(musicTools.getAllAlbum()));
|
||||
json.put("data", JSON.toJSON(musicTools.getAllAlbum()));
|
||||
} else {
|
||||
json.put("data", JSONArray.toJSON(musicTools.selectAlbum(album, true)));
|
||||
json.put("data", JSON.toJSON(musicTools.selectAlbum(album, true)));
|
||||
}
|
||||
return json.toJSONString();
|
||||
}
|
||||
@ -84,9 +85,9 @@ public class MusicController {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", 0);
|
||||
if (StringUtils.isEmpty(artist)) {
|
||||
json.put("data", JSONArray.toJSON(musicTools.getAllArtist()));
|
||||
json.put("data", JSON.toJSON(musicTools.getAllArtist()));
|
||||
} else {
|
||||
json.put("data", JSONArray.toJSON(musicTools.selectArtist(artist, true)));
|
||||
json.put("data", JSON.toJSON(musicTools.selectArtist(artist, true)));
|
||||
}
|
||||
return json.toJSONString();
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
package com.yutou.nas.Controllers;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.mybatis.dao.MusicDataDao;
|
||||
import com.yutou.nas.mybatis.dao.MusicFavoritesDao;
|
||||
import com.yutou.nas.mybatis.dao.MusicFavoritesDirDao;
|
||||
@ -152,7 +153,7 @@ public class MusicFavoritesController {
|
||||
}
|
||||
list.clear();
|
||||
json.put("code", 0);
|
||||
json.put("data", JSONArray.toJSON(dataList));
|
||||
json.put("data", JSON.toJSON(dataList));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
json.put("code", -1);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.yutou.nas.Controllers;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.interfaces.DownloadInterface;
|
||||
import com.yutou.nas.utils.QQBotManager;
|
||||
import com.yutou.nas.utils.Tools;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.yutou.nas.Controllers;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.yutou.nas.utils.*;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yutou.nas.Controllers;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.utils.RedisTools;
|
||||
import com.yutou.nas.utils.Tools;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@ -60,7 +61,7 @@ public class UpdateIp {
|
||||
if(isNas){
|
||||
String adminAddress= RedisTools.get("adminAddress");
|
||||
if(adminAddress!=null) {
|
||||
JSONObject json=JSONObject.parseObject(adminAddress);
|
||||
JSONObject json= JSON.parseObject(adminAddress);
|
||||
line = "proxy_pass http://" +ip+":"+json.getInteger("port")+"/;";
|
||||
}else{
|
||||
line = line.replace(testIp, ip);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.yutou.nas.Datas.Jellyfin;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.utils.AppTools;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.yutou.nas.Datas.Jellyfin;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
|
@ -12,7 +12,7 @@ import org.springframework.context.annotation.Import;
|
||||
@Import(BTDownloadManager.class)
|
||||
@SpringBootApplication
|
||||
public class NasApplication {
|
||||
public static final String version="1.2.12";
|
||||
public static final String version="1.2.13";
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(NasApplication.class, args);
|
||||
AppData.defaultMusicPath = (String) ConfigTools.load(ConfigTools.CONFIG, "musicDir");
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.yutou.nas.Services.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.Datas.AppData;
|
||||
import com.yutou.nas.mybatis.dao.MusicDataDao;
|
||||
import com.yutou.nas.mybatis.model.MusicData;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.yutou.nas.Services.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.Services.IVideoToolsService;
|
||||
import com.yutou.nas.bangumi.BangumiTools;
|
||||
import com.yutou.nas.interfaces.ObjectInterface;
|
||||
|
@ -1,7 +1,8 @@
|
||||
package com.yutou.nas.bangumi;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.mybatis.dao.BangumiItemDao;
|
||||
import com.yutou.nas.mybatis.dao.BangumiListDao;
|
||||
import com.yutou.nas.mybatis.model.BangumiItem;
|
||||
@ -67,7 +68,7 @@ public class AnimationController {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", 0);
|
||||
json.put("msg", "ok");
|
||||
json.put("data", JSONArray.toJSON(listDao.selectByExample(new BangumiListExample())));
|
||||
json.put("data", JSON.toJSON(listDao.selectByExample(new BangumiListExample())));
|
||||
return json.toJSONString();
|
||||
}
|
||||
@ResponseBody
|
||||
@ -107,7 +108,7 @@ public class AnimationController {
|
||||
example.createCriteria().andBidEqualTo(type);
|
||||
json.put("code", 0);
|
||||
json.put("msg", "ok");
|
||||
json.put("data", JSONArray.toJSON(itemDao.selectByExample(example)));
|
||||
json.put("data", JSON.toJSON(itemDao.selectByExample(example)));
|
||||
return json.toJSONString();
|
||||
}
|
||||
@ResponseBody
|
||||
@ -128,7 +129,7 @@ public class AnimationController {
|
||||
item.setCategories(animationData.nameToValue(item.getCategories(),false)+"");
|
||||
item.setAuthor(animationData.nameToValue(item.getAuthor(),true)+"");
|
||||
}
|
||||
JSONArray array= (JSONArray) JSONArray.toJSON(list);
|
||||
JSONArray array= (JSONArray) JSON.toJSON(list);
|
||||
return array.toJSONString();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
package com.yutou.nas.bangumi;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.utils.HttpTools;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
@ -25,7 +26,7 @@ public class AnimationData {
|
||||
com.yutou.nas.utils.Log.i(String.format(animUrl, "" + index, title,type,team));
|
||||
com.yutou.nas.utils.Log.i(rss2jsonUrl + URLEncoder.encode(String.format(animUrl, "" + index, title,type,team), "UTF-8") +String.format( "&api_key=%s&count=500",rss2jsonApi_2));
|
||||
String js= HttpTools.get(rss2jsonUrl+ URLEncoder.encode(String.format(animUrl,""+index,title,type,team),"UTF-8")+String.format( "&api_key=%s&count=500",rss2jsonApi_2));
|
||||
JSONObject json=JSONObject.parseObject(js);
|
||||
JSONObject json= JSON.parseObject(js);
|
||||
if(json.getString("status").equals("ok")){
|
||||
return json.getJSONArray("items");
|
||||
}
|
||||
@ -37,9 +38,9 @@ public class AnimationData {
|
||||
public int nameToValue(String name,boolean isTeam){
|
||||
JSONArray array;
|
||||
if(isTeam){
|
||||
array=JSONArray.parseArray(team);
|
||||
array=JSON.parseArray(team);
|
||||
}else{
|
||||
array=JSONArray.parseArray(type);
|
||||
array=JSON.parseArray(type);
|
||||
}
|
||||
for (Object o : array) {
|
||||
JSONObject json= (JSONObject) o;
|
||||
|
@ -1,7 +1,8 @@
|
||||
package com.yutou.nas.bangumi;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.utils.*;
|
||||
|
||||
import java.text.ParseException;
|
||||
@ -22,7 +23,7 @@ public class BangumiTools {
|
||||
*/
|
||||
public static JSONObject getBangumi(int day) {
|
||||
String str = HttpTools.get(toDayBangumi);
|
||||
JSONArray main = JSONArray.parseArray(str);
|
||||
JSONArray main = JSON.parseArray(str);
|
||||
if (day == -1) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("bangumi", main);
|
||||
@ -57,7 +58,7 @@ public class BangumiTools {
|
||||
*/
|
||||
public static JSONObject getBangumiInfo(int id) {
|
||||
String str = HttpTools.get(String.format(BangumiInfo, id + ""));
|
||||
return JSONObject.parseObject(str);
|
||||
return JSON.parseObject(str);
|
||||
}
|
||||
|
||||
public static JSONArray getPeople(int id) {
|
||||
@ -114,7 +115,7 @@ public class BangumiTools {
|
||||
*/
|
||||
public static JSONObject search(String key) {
|
||||
String str = HttpTools.get(String.format(SearchBangumi, key));
|
||||
return JSONObject.parseObject(str);
|
||||
return JSON.parseObject(str);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,8 @@
|
||||
package com.yutou.nas.other;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.NasApplication;
|
||||
import com.yutou.nas.Services.IVideoToolsService;
|
||||
import com.yutou.nas.utils.AppTools;
|
||||
@ -79,7 +80,7 @@ public class tools {
|
||||
}
|
||||
if (request.getCookies() != null) {
|
||||
for (Cookie cookie : request.getCookies()) {
|
||||
JSONObject ck = JSONObject.parseObject(JSONObject.toJSONString(cookie));
|
||||
JSONObject ck = JSON.parseObject(JSON.toJSONString(cookie));
|
||||
cookies.add(ck);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
package com.yutou.nas.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.Services.IBangumiService;
|
||||
import com.yutou.nas.bangumi.AnimationData;
|
||||
import com.yutou.nas.mybatis.model.BangumiItem;
|
||||
@ -63,7 +64,7 @@ public class BTDownloadManager implements ApplicationContextAware {
|
||||
String url = getRSSUrl(item);
|
||||
String _json = HttpTools.get(url);
|
||||
if (!StringUtils.isEmpty(_json)) {
|
||||
JSONObject json = JSONObject.parseObject(_json);
|
||||
JSONObject json = JSON.parseObject(_json);
|
||||
download(item, json);
|
||||
} else {
|
||||
QQBotManager.getInstance().sendMessage(item.getTitle() + "\n下载失败\n"+getDmhyUrl(item));
|
||||
@ -153,7 +154,7 @@ public class BTDownloadManager implements ApplicationContextAware {
|
||||
if (StringUtils.isEmpty(_title)) {
|
||||
return new JSONArray();
|
||||
}
|
||||
return JSONArray.parseArray(_title);
|
||||
return JSON.parseArray(_title);
|
||||
}
|
||||
|
||||
private boolean isDownload(String title, String key) {
|
||||
@ -162,7 +163,7 @@ public class BTDownloadManager implements ApplicationContextAware {
|
||||
if (StringUtils.isEmpty(_title)) {
|
||||
return false;
|
||||
} else {
|
||||
array = JSONArray.parseArray(_title);
|
||||
array = JSON.parseArray(_title);
|
||||
}
|
||||
return array.contains(key);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yutou.nas.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.HashSet;
|
||||
@ -45,7 +46,7 @@ public class ConfigTools {
|
||||
String src = readFile(file);
|
||||
if (src != null) {
|
||||
try {
|
||||
JSONObject json = JSONObject.parseObject(src);
|
||||
JSONObject json = JSON.parseObject(src);
|
||||
return json.getObject(key, t);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
@ -81,7 +82,7 @@ public class ConfigTools {
|
||||
if (src == null) {
|
||||
src = "{}";
|
||||
}
|
||||
JSONObject json = JSONObject.parseObject(src);
|
||||
JSONObject json = JSON.parseObject(src);
|
||||
json.put(key, data);
|
||||
saveFile(file, json.toJSONString());
|
||||
return false;
|
||||
|
@ -1,7 +1,8 @@
|
||||
package com.yutou.nas.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.interfaces.DownloadInterface;
|
||||
import com.yutou.nas.utils.StringUtils;
|
||||
|
||||
@ -22,12 +23,12 @@ public class DepotManager {
|
||||
public void run() {
|
||||
String str = HttpTools.get("http://tools.yutou233.cn/nas/depot/list.do?token=" + HttpTools.serverKey);
|
||||
if (!StringUtils.isEmpty(str)) {
|
||||
JSONObject json = JSONObject.parseObject(str);
|
||||
JSONObject json = JSON.parseObject(str);
|
||||
if (json.getInteger("code") == 1) {
|
||||
JSONArray array = json.getJSONArray("data");
|
||||
for (Object o : array) {
|
||||
List<File> list = new ArrayList<>();
|
||||
JSONObject item = JSONObject.parseObject(o.toString());
|
||||
JSONObject item = JSON.parseObject(o.toString());
|
||||
scanFile(new File(item.getString("path")), new DownloadInterface() {
|
||||
@Override
|
||||
public void onDownload(File file) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.yutou.nas.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.interfaces.DownloadInterface;
|
||||
import com.yutou.nas.utils.Interfaces.NetworkInterface;
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
package com.yutou.nas.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.Datas.Jellyfin.Episode;
|
||||
import com.yutou.nas.Datas.Jellyfin.EpisodeData;
|
||||
import com.yutou.nas.Datas.Jellyfin.ItemInfo;
|
||||
@ -25,13 +26,13 @@ public class JellyfinAPIManager {
|
||||
public LibsItem getLibs(String key) {
|
||||
HashMap<String, String> header = getHeader();
|
||||
String httpText = HttpTools.https_get("http://192.168.31.88:8096/Users/e8a13675bb64466dbd81f1e5985ef8c7/Items", header);
|
||||
JSONObject json = JSONObject.parseObject(httpText);
|
||||
JSONObject json = JSON.parseObject(httpText);
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
JSONArray items = json.getJSONArray("Items");
|
||||
for (Object o : items) {
|
||||
LibsItem item = JSONObject.parseObject(o.toString(), LibsItem.class);
|
||||
LibsItem item = JSON.parseObject(o.toString(), LibsItem.class);
|
||||
if (item.getName().equals(key)) {
|
||||
return item;
|
||||
}
|
||||
@ -41,15 +42,15 @@ public class JellyfinAPIManager {
|
||||
|
||||
public ItemInfo getInfo(String id) {
|
||||
String http = HttpTools.https_get("http://192.168.31.88:8096/Users/e8a13675bb64466dbd81f1e5985ef8c7/Items/" + id, getHeader());
|
||||
return JSONObject.parseObject(http, ItemInfo.class);
|
||||
return JSON.parseObject(http, ItemInfo.class);
|
||||
}
|
||||
|
||||
public List<LibsItem> getAllItem() {
|
||||
String http = HttpTools.https_get("http://192.168.31.88:8096/Users/e8a13675bb64466dbd81f1e5985ef8c7/Items?SortBy=SortName&SortOrder=Ascending&IncludeItemTypes=Series&Recursive=true&Fields=PrimaryImageAspectRatio%2CBasicSyncInfo&ImageTypeLimit=1&EnableImageTypes=Primary%2CBackdrop%2CBanner%2CThumb&ParentId=28e774baf8f2fd279e7d58da9890a7d2", getHeader());
|
||||
JSONObject json = JSONObject.parseObject(http);
|
||||
JSONObject json = JSON.parseObject(http);
|
||||
|
||||
JSONArray items = json.getJSONArray("Items");
|
||||
List<LibsItem> list = JSONArray.parseArray(items.toJSONString(), LibsItem.class);
|
||||
List<LibsItem> list = JSON.parseArray(items.toJSONString(), LibsItem.class);
|
||||
for (LibsItem item : list) {
|
||||
item.setInfo(getInfo(item.getId()));
|
||||
}
|
||||
@ -58,16 +59,16 @@ public class JellyfinAPIManager {
|
||||
|
||||
public List<LibsItem> getLibsItems(String id) {
|
||||
String httpText = HttpTools.https_get("http://192.168.31.88:8096/Users/e8a13675bb64466dbd81f1e5985ef8c7/Items?ParentId=" + id, getHeader());
|
||||
JSONObject json = JSONObject.parseObject(httpText);
|
||||
JSONObject json = JSON.parseObject(httpText);
|
||||
JSONArray items = json.getJSONArray("Items");
|
||||
return JSONArray.parseArray(items.toJSONString(), LibsItem.class);
|
||||
return JSON.parseArray(items.toJSONString(), LibsItem.class);
|
||||
}
|
||||
|
||||
public JSONObject getItemShows(String id) {
|
||||
String data = HttpTools.https_get(String.format("http://192.168.31.88:8096/Shows/%s/Seasons?userId=e8a13675bb64466dbd81f1e5985ef8c7",
|
||||
id
|
||||
), getHeader());
|
||||
return JSONObject.parseObject(data);
|
||||
return JSON.parseObject(data);
|
||||
}
|
||||
|
||||
public JSONObject getEpisodesForJson(String parentID, String id) {
|
||||
@ -75,24 +76,24 @@ public class JellyfinAPIManager {
|
||||
parentID,
|
||||
id
|
||||
), getHeader());
|
||||
return JSONObject.parseObject(data);
|
||||
return JSON.parseObject(data);
|
||||
}
|
||||
|
||||
public List<Episode> getEpisodes(String parentId, String id) {
|
||||
JSONObject json = getEpisodesForJson(parentId, id);
|
||||
JSONArray episodes = json.getJSONArray("Items");
|
||||
return JSONArray.parseArray(episodes.toJSONString(), Episode.class);
|
||||
return JSON.parseArray(episodes.toJSONString(), Episode.class);
|
||||
}
|
||||
|
||||
public JSONObject getEpisodesDataForJson(String id) {
|
||||
String data = HttpTools.https_get(String.format("http://192.168.31.88:8096/Users/e8a13675bb64466dbd81f1e5985ef8c7/Items/%s",
|
||||
id
|
||||
), getHeader());
|
||||
return JSONObject.parseObject(data);
|
||||
return JSON.parseObject(data);
|
||||
}
|
||||
|
||||
public EpisodeData getEpisodeData(String id) {
|
||||
return JSONObject.parseObject(getEpisodesDataForJson(id).toString(), EpisodeData.class);
|
||||
return JSON.parseObject(getEpisodesDataForJson(id).toString(), EpisodeData.class);
|
||||
}
|
||||
|
||||
public String getPathForEpisode(String parentId, String id) {
|
||||
@ -227,19 +228,19 @@ public class JellyfinAPIManager {
|
||||
System.out.println(_json.getString("Name"));
|
||||
|
||||
if (_json.getString("Name").equals("第一季")) {
|
||||
LibsItem _item = JSONObject.parseObject(_json.toJSONString(), LibsItem.class);
|
||||
LibsItem _item = JSON.parseObject(_json.toJSONString(), LibsItem.class);
|
||||
manager.saveJellyfinMetaData(
|
||||
BangumiTools.getBangumiInfo(1424),
|
||||
_item
|
||||
);
|
||||
} else if (_json.getString("Name").equals("第二季")) {
|
||||
LibsItem _item = JSONObject.parseObject(_json.toJSONString(), LibsItem.class);
|
||||
LibsItem _item = JSON.parseObject(_json.toJSONString(), LibsItem.class);
|
||||
manager.saveJellyfinMetaData(
|
||||
BangumiTools.getBangumiInfo(3774),
|
||||
_item
|
||||
);
|
||||
} else if (_json.getString("Name").contains("[剧场版]")) {
|
||||
LibsItem _item = JSONObject.parseObject(_json.toJSONString(), LibsItem.class);
|
||||
LibsItem _item = JSON.parseObject(_json.toJSONString(), LibsItem.class);
|
||||
manager.saveJellyfinMetaData(
|
||||
BangumiTools.getBangumiInfo(12426),
|
||||
_item
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.yutou.nas.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yutou.nas.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.interfaces.DownloadInterface;
|
||||
import com.yutou.nas.interfaces.ObjectInterface;
|
||||
import redis.clients.jedis.Jedis;
|
||||
@ -270,7 +271,7 @@ public class RedisTools {
|
||||
public static void bot(String value) {
|
||||
switch (value) {
|
||||
case "getip":
|
||||
JSONObject json = JSONObject.parseObject(HttpTools.get("https://api.asilu.com/ip/"));
|
||||
JSONObject json = JSON.parseObject(HttpTools.get("https://api.asilu.com/ip/"));
|
||||
String ip = json.getString("ip");
|
||||
QQBotManager.getInstance().sendMessage("服务器IP:\n" + ip);
|
||||
break;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yutou.nas.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.yutou.nas.Controllers.UpdateIp;
|
||||
import com.yutou.nas.interfaces.DownloadInterface;
|
||||
import com.yutou.nas.interfaces.ObjectInterface;
|
||||
@ -206,7 +207,7 @@ public class Tools {
|
||||
public static int checkWebLogin(HttpServletRequest request) {
|
||||
JSONArray array = new JSONArray();
|
||||
if (RedisTools.get("bean") != null) {
|
||||
array = JSONArray.parseArray(RedisTools.get("bean"));
|
||||
array = JSON.parseArray(RedisTools.get("bean"));
|
||||
}
|
||||
if (array.contains(Tools.getRemoteAddress(request))) {
|
||||
com.yutou.nas.utils.Log.i("IP已被封禁");
|
||||
|
Loading…
Reference in New Issue
Block a user