update nas_ip

This commit is contained in:
Yutousama 2023-03-17 17:48:10 +08:00
parent f50dcb2244
commit dd1fcb8145
4 changed files with 18 additions and 17 deletions

0
mvnw vendored Normal file → Executable file
View File

View File

@ -1,6 +1,7 @@
package com.yutou.nas.Controllers; package com.yutou.nas.Controllers;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.yutou.nas.utils.ConfigTools;
import com.yutou.nas.utils.RedisTools; import com.yutou.nas.utils.RedisTools;
import com.yutou.nas.utils.StringUtils; import com.yutou.nas.utils.StringUtils;
import com.yutou.nas.utils.Tools; import com.yutou.nas.utils.Tools;
@ -31,7 +32,7 @@ public class DoorController {
if(file.exists()&& Objects.requireNonNull(file.listFiles()).length!=0){ if(file.exists()&& Objects.requireNonNull(file.listFiles()).length!=0){
JSONObject update=new JSONObject(); JSONObject update=new JSONObject();
update.put("versionName", Objects.requireNonNull(file.listFiles())[0].getName().replace("app-release-","").replace(".apk","")); update.put("versionName", Objects.requireNonNull(file.listFiles())[0].getName().replace("app-release-","").replace(".apk",""));
update.put("url","http://192.168.31.88:803/apk/door/"+ Objects.requireNonNull(file.listFiles())[0].getName()); update.put("url","http://"+ ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":803/apk/door/"+ Objects.requireNonNull(file.listFiles())[0].getName());
json.put("update",update); json.put("update",update);
} }
RedisTools.remove("door_audio"); RedisTools.remove("door_audio");
@ -57,7 +58,7 @@ public class DoorController {
System.out.println("收到音频"); System.out.println("收到音频");
try { try {
String path=Tools.createFile("audio",audio,System.currentTimeMillis()+".mp3"); String path=Tools.createFile("audio",audio,System.currentTimeMillis()+".mp3");
RedisTools.set("door_audio","http://192.168.31.88:801/"+path); RedisTools.set("door_audio","http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":801/"+path);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -28,7 +28,7 @@ public class JellyfinAPIManager {
public LibsItem getLibs(String key) { public LibsItem getLibs(String key) {
HashMap<String, String> header = getHeader(); HashMap<String, String> header = getHeader();
String httpText = HttpTools.https_get("http://192.168.31.88:8096/Users/"+userId+"/Items", header); String httpText = HttpTools.https_get("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Users/"+userId+"/Items", header);
JSONObject json = JSON.parseObject(httpText); JSONObject json = JSON.parseObject(httpText);
if (key == null) { if (key == null) {
return null; return null;
@ -44,12 +44,12 @@ public class JellyfinAPIManager {
} }
public ItemInfo getInfo(String id) { public ItemInfo getInfo(String id) {
String http = HttpTools.https_get("http://192.168.31.88:8096/Users/"+userId+"/Items/" + id, getHeader()); String http = HttpTools.https_get("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Users/"+userId+"/Items/" + id, getHeader());
return JSON.parseObject(http).toJavaObject(ItemInfo.class); return JSON.parseObject(http).toJavaObject(ItemInfo.class);
} }
public List<LibsItem> getAllItem() { public List<LibsItem> getAllItem() {
String http = HttpTools.https_get("http://192.168.31.88:8096/Users/"+userId+"/Items?SortBy=SortName&SortOrder=Ascending&IncludeItemTypes=Series&Recursive=true&Fields=PrimaryImageAspectRatio%2CBasicSyncInfo&ImageTypeLimit=1&EnableImageTypes=Primary%2CBackdrop%2CBanner%2CThumb&ParentId=28e774baf8f2fd279e7d58da9890a7d2", getHeader()); String http = HttpTools.https_get("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Users/"+userId+"/Items?SortBy=SortName&SortOrder=Ascending&IncludeItemTypes=Series&Recursive=true&Fields=PrimaryImageAspectRatio%2CBasicSyncInfo&ImageTypeLimit=1&EnableImageTypes=Primary%2CBackdrop%2CBanner%2CThumb&ParentId=28e774baf8f2fd279e7d58da9890a7d2", getHeader());
JSONObject json = JSON.parseObject(http); JSONObject json = JSON.parseObject(http);
JSONArray items = json.getJSONArray("Items"); JSONArray items = json.getJSONArray("Items");
@ -61,21 +61,21 @@ public class JellyfinAPIManager {
} }
public List<LibsItem> getLibsItems(String id) { public List<LibsItem> getLibsItems(String id) {
String httpText = HttpTools.https_get("http://192.168.31.88:8096/Users/"+userId+"/Items?ParentId=" + id, getHeader()); String httpText = HttpTools.https_get("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Users/"+userId+"/Items?ParentId=" + id, getHeader());
JSONObject json = JSON.parseObject(httpText); JSONObject json = JSON.parseObject(httpText);
JSONArray items = json.getJSONArray("Items"); JSONArray items = json.getJSONArray("Items");
return items.toJavaList(LibsItem.class); return items.toJavaList(LibsItem.class);
} }
public JSONObject getItemShows(String id) { public JSONObject getItemShows(String id) {
String data = HttpTools.https_get(String.format("http://192.168.31.88:8096/Shows/%s/Seasons?userId="+userId+"", String data = HttpTools.https_get(String.format("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Shows/%s/Seasons?userId="+userId+"",
id id
), getHeader()); ), getHeader());
return JSON.parseObject(data); return JSON.parseObject(data);
} }
public JSONObject getEpisodesForJson(String parentID, String id) { public JSONObject getEpisodesForJson(String parentID, String id) {
String data = HttpTools.https_get(String.format("http://192.168.31.88:8096/Shows/%s/Episodes?seasonId=%s&userId="+userId+"", String data = HttpTools.https_get(String.format("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Shows/%s/Episodes?seasonId=%s&userId="+userId+"",
parentID, parentID,
id id
), getHeader()); ), getHeader());
@ -89,7 +89,7 @@ public class JellyfinAPIManager {
} }
public JSONObject getEpisodesDataForJson(String id) { public JSONObject getEpisodesDataForJson(String id) {
String data = HttpTools.https_get(String.format("http://192.168.31.88:8096/Users/"+userId+"/Items/%s", String data = HttpTools.https_get(String.format("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Users/"+userId+"/Items/%s",
id id
), getHeader()); ), getHeader());
return JSON.parseObject(data); return JSON.parseObject(data);
@ -112,7 +112,7 @@ public class JellyfinAPIManager {
try { try {
HashMap<String, String> header = getHeader(); HashMap<String, String> header = getHeader();
header.put("Content-Type", "image/jpeg"); header.put("Content-Type", "image/jpeg");
String url = String.format("http://192.168.31.88:8096/Items/%s/Images/%s", String url = String.format("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Items/%s/Images/%s",
id, id,
model model
); );
@ -178,7 +178,7 @@ 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");
String ret = HttpTools.http_post("http://192.168.31.88:8096/Items/" + item.getId() String ret = HttpTools.http_post("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":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);
@ -280,7 +280,7 @@ public class JellyfinAPIManager {
return array; return array;
} }
public void refresh(){ public void refresh(){
String url="http://192.168.31.88:8096/Items/28e774baf8f2fd279e7d58da9890a7d2/Refresh?Recursive=true&ImageRefreshMode=Default&MetadataRefreshMode=Default&ReplaceAllImages=false&ReplaceAllMetadata=false"; String url="http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Items/28e774baf8f2fd279e7d58da9890a7d2/Refresh?Recursive=true&ImageRefreshMode=Default&MetadataRefreshMode=Default&ReplaceAllImages=false&ReplaceAllMetadata=false";
String tmp=HttpTools.http_post(url,null,1,getHeader()); String tmp=HttpTools.http_post(url,null,1,getHeader());
System.out.println(tmp); System.out.println(tmp);
} }
@ -334,7 +334,7 @@ public class JellyfinAPIManager {
public static String mainPath = "Z:\\download\\anim\\"; public static String mainPath = "Z:\\download\\anim\\";
public void login(){ public void login(){
String url="http://192.168.31.88:8096/Users/authenticatebyname"; String url="http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Users/authenticatebyname";
HashMap<String, String> header=getHttpHeader(); HashMap<String, String> header=getHttpHeader();
JSONObject json=new JSONObject(); JSONObject json=new JSONObject();
json.put("Pw","34864394"); json.put("Pw","34864394");
@ -350,7 +350,7 @@ public class JellyfinAPIManager {
header.put("accept", "application/json"); header.put("accept", "application/json");
header.put("Connection", "keep-alive"); header.put("Connection", "keep-alive");
header.put("User-Agent", HttpTools.getUa()); header.put("User-Agent", HttpTools.getUa());
header.put("Origin", "http://192.168.31.88:8096"); header.put("Origin", "http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096");
header.put("X-Emby-Authorization", "MediaBrowser Client=\"Jellyfin Web\", Device=\"Chrome\", DeviceId=\"TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzg2LjAuNDI0MC43NSBTYWZhcmkvNTM3LjM2fDE2MDI4NDYzMDc5NjE1\", Version=\"10.8.1\""); header.put("X-Emby-Authorization", "MediaBrowser Client=\"Jellyfin Web\", Device=\"Chrome\", DeviceId=\"TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzg2LjAuNDI0MC43NSBTYWZhcmkvNTM3LjM2fDE2MDI4NDYzMDc5NjE1\", Version=\"10.8.1\"");
return header; return header;
} }

View File

@ -35,7 +35,7 @@ public class QQBotManager {
json.put("message",text); json.put("message",text);
Map<String, String> header = new HashMap<>(); Map<String, String> header = new HashMap<>();
header.put("content-type", "application/json"); header.put("content-type", "application/json");
return HttpTools.http_post("http://192.168.31.88:802/qq/send.do", json.toString().getBytes(StandardCharsets.UTF_8), 1, header); return HttpTools.http_post("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":802/qq/send.do", json.toString().getBytes(StandardCharsets.UTF_8), 1, header);
} }
public String sendMessage(long qq,String text) { public String sendMessage(long qq,String text) {
@ -44,7 +44,7 @@ public class QQBotManager {
json.put("message",text); json.put("message",text);
Map<String, String> header = new HashMap<>(); Map<String, String> header = new HashMap<>();
header.put("content-type", "application/json"); header.put("content-type", "application/json");
return HttpTools.http_post("http://192.168.31.88:802/qq/send.do", json.toString().getBytes(StandardCharsets.UTF_8), 1, header); return HttpTools.http_post("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":802/qq/send.do", json.toString().getBytes(StandardCharsets.UTF_8), 1, header);
} }
public String sendMessage(String imageUrl, String message) { public String sendMessage(String imageUrl, String message) {
@ -57,7 +57,7 @@ public class QQBotManager {
json.put("image", imageUrl); json.put("image", imageUrl);
Map<String, String> header = new HashMap<>(); Map<String, String> header = new HashMap<>();
header.put("content-type", "application/json"); header.put("content-type", "application/json");
return HttpTools.http_post("http://192.168.31.88:802/qq/send.do", json.toString().getBytes(StandardCharsets.UTF_8), 1, header); return HttpTools.http_post("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":802/qq/send.do", json.toString().getBytes(StandardCharsets.UTF_8), 1, header);
} }