From d2f0be5adbf067b32e233844fab228e5bd3a18d0 Mon Sep 17 00:00:00 2001
From: Yutousama <583819556@qq.com>
Date: Sun, 10 Apr 2022 21:43:19 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7QQ=E6=9C=BA=E5=99=A8=E4=BA=BA?=
=?UTF-8?q?=20=E8=B0=83=E6=95=B4=E7=9B=B4=E6=92=AD=E7=8A=B6=E6=80=81?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81=20=E8=B0=83=E6=95=B4=E5=BD=95=E5=83=8F?=
=?UTF-8?q?=E8=B7=AF=E5=BE=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 38 +++++-----
.../com/yutou/bilibili/BiliBili/Live.java | 7 +-
.../bilibili/BiliBili/Tools/SaveLive.java | 11 ++-
.../yutou/bilibili/BilibiliApplication.java | 2 +-
.../yutou/bilibili/QQBot/QQBotManager.java | 69 +++++++++----------
5 files changed, 64 insertions(+), 63 deletions(-)
diff --git a/pom.xml b/pom.xml
index 07dbc96..56158ce 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
Demo project for Spring Boot
1.8
- 1.4.10
+ 1.6.10
@@ -54,23 +54,23 @@
com.alibaba
fastjson
- 1.2.73
+ 1.2.80
org.xerial
sqlite-jdbc
- 3.28.0
+ 3.36.0.3
org.projectlombok
lombok
- 1.18.12
+ 1.18.22
provided
org.java-websocket
Java-WebSocket
- 1.5.1
+ 1.5.2
mysql
@@ -80,45 +80,50 @@
org.mybatis.spring.boot
mybatis-spring-boot-starter
- 2.1.1
+ 2.2.2
org.apache.poi
poi
- 3.17
+ 5.2.2
org.apache.poi
poi-scratchpad
- 3.17
+ 5.2.2
org.apache.poi
poi-ooxml
- 3.17
+ 5.2.2
org.apache.poi
poi-ooxml-schemas
- 3.17
+ 4.1.2
net.mamoe
mirai-core-jvm
- 2.5.0
+ 2.10.0
- org.jetbrains.kotlin
- kotlin-stdlib
- ${kotlin.version}
+ org.jetbrains.kotlinx
+ kotlinx-coroutines-jdk8
+ 1.6.0-native-mt
+
+
+ org.jetbrains.kotlinx
+ kotlinx-coroutines-core-jvm
+ 1.6.0-native-mt
redis.clients
jedis
- 3.6.0-RC1
+ 4.2.0
@@ -181,9 +186,6 @@
-
- Z:\servier\biliob\
-
diff --git a/src/main/java/com/yutou/bilibili/BiliBili/Live.java b/src/main/java/com/yutou/bilibili/BiliBili/Live.java
index 9a81b2b..95faf30 100644
--- a/src/main/java/com/yutou/bilibili/BiliBili/Live.java
+++ b/src/main/java/com/yutou/bilibili/BiliBili/Live.java
@@ -108,7 +108,7 @@ public class Live implements ApplicationContextAware {
private void updateUpInfo() {
try {
upData = service.queryUp(upData);
- upData.setLive(1);
+ //upData.setLive(1);
if (upData.getSavedanmu() == 1) {
danmuManager = new BiliBiliLiveDatabasesManager();
danmuManager.init("[" + AppTools.getToDayTime() + "]" + upData.getRoomid());
@@ -329,7 +329,6 @@ public class Live implements ApplicationContextAware {
}
public void checkLive() {
-
boolean isLive = LiveUtils.isLivePlayer(roomId);
upData.setLive(isLive ? 1 : 0);
System.out.println(roomId+"直播状态="+isLive);
@@ -354,6 +353,9 @@ public class Live implements ApplicationContextAware {
* @param bytes 原始hex数据
*/
public void processData(String msg, byte[] bytes) {
+ if(msg.contains("[object Object]")){
+ return;
+ }
try {
JSONObject json = JSONObject.parseObject(msg);
JSONObject data;
@@ -552,6 +554,7 @@ public class Live implements ApplicationContextAware {
checkLive();
} catch (Exception e) {
Log.e(e);
+ Log.i("msg = "+msg);
// Log.i(AppTools.getToDayTimeToString(startTime), roomId, e.getLocalizedMessage());
/*try {
JSONObject.parseObject(new String(bytes, StandardCharsets.UTF_8));
diff --git a/src/main/java/com/yutou/bilibili/BiliBili/Tools/SaveLive.java b/src/main/java/com/yutou/bilibili/BiliBili/Tools/SaveLive.java
index b68ab30..0d7ecc0 100644
--- a/src/main/java/com/yutou/bilibili/BiliBili/Tools/SaveLive.java
+++ b/src/main/java/com/yutou/bilibili/BiliBili/Tools/SaveLive.java
@@ -5,10 +5,7 @@ import com.yutou.bilibili.BiliBili.Datas.AppData;
import com.yutou.bilibili.BiliBili.Live;
import com.yutou.bilibili.BiliBili.LiveUtils;
import com.yutou.bilibili.QQBot.QQBotManager;
-import com.yutou.bilibili.Tools.AppTools;
-import com.yutou.bilibili.Tools.FFmpegUtils;
-import com.yutou.bilibili.Tools.HttpTools;
-import com.yutou.bilibili.Tools.Log;
+import com.yutou.bilibili.Tools.*;
import java.io.*;
import java.net.HttpURLConnection;
@@ -140,7 +137,8 @@ public class SaveLive {
}
private void ffmpegDownload(String url) throws Exception {
- liveFile = new File(String.format("live%s%s%s[%s]%d.mp4",
+ liveFile = new File(String.format("%slive%s%s%s[%s]%d.mp4",
+ ConfigTools.load(ConfigTools.CONFIG,"liveSavePath"),
File.separator,
AppTools.getToDayTime(),
File.separator,
@@ -189,7 +187,8 @@ public class SaveLive {
heartbeats.put(roomId, heartbeat);
//heartbeats.add(beat);
InputStream inputStream = connection.getInputStream();
- liveFile = new File(String.format("live%s%s%s[%s]%d.mp4",
+ liveFile = new File(String.format("%slive%s%s%s[%s]%d.mp4",
+ ConfigTools.load(ConfigTools.CONFIG,"liveSavePath"),
File.separator,
AppTools.getToDayTime(),
File.separator,
diff --git a/src/main/java/com/yutou/bilibili/BilibiliApplication.java b/src/main/java/com/yutou/bilibili/BilibiliApplication.java
index cbf4391..37f78cf 100644
--- a/src/main/java/com/yutou/bilibili/BilibiliApplication.java
+++ b/src/main/java/com/yutou/bilibili/BilibiliApplication.java
@@ -13,7 +13,7 @@ import org.springframework.context.annotation.Import;
@SpringBootApplication
public class BilibiliApplication {
- public static String version="0.8";
+ public static String version="0.8.3";
public static void main(String[] args) {
QQBotManager.getInstance().init();
diff --git a/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java b/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java
index b887a7d..4cfcf2b 100644
--- a/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java
+++ b/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java
@@ -84,44 +84,41 @@ public class QQBotManager implements ApplicationContextAware {
if (!((boolean) ConfigTools.load(ConfigTools.CONFIG, "qq_bot"))) {
return;
}
- new Thread(new Runnable() {
- @Override
- public void run() {
- long qq = Long.parseLong((String) ConfigTools.load(ConfigTools.CONFIG, "qq_number"));
- String password = (String) ConfigTools.load(ConfigTools.CONFIG, "qq_password");
- bot = BotFactory.INSTANCE.newBot(qq, password, new BotConfiguration() {
- {
- setProtocol(MiraiProtocol.ANDROID_PAD);
- fileBasedDeviceInfo("qq_bot_devices_info.json");
- if (!((boolean) ConfigTools.load(ConfigTools.CONFIG, "qq_debug"))) {
- noBotLog();
- noNetworkLog();
- }
+ new Thread(() -> {
+ long qq = Long.parseLong((String) ConfigTools.load(ConfigTools.CONFIG, "qq_number"));
+ String password = (String) ConfigTools.load(ConfigTools.CONFIG, "qq_password");
+ bot = BotFactory.INSTANCE.newBot(qq, password, new BotConfiguration() {
+ {
+ setProtocol(MiraiProtocol.ANDROID_PAD);
+ fileBasedDeviceInfo("qq_bot_devices_info.json");
+ if (!((boolean) ConfigTools.load(ConfigTools.CONFIG, "qq_debug"))) {
+ noBotLog();
+ noNetworkLog();
}
- });
- //Events.registerEvents(bot, new MessageListener());
- GlobalEventChannel.INSTANCE.subscribeAlways(GroupMessageEvent.class, new MessageListener());
- Log.i("准备登陆");
- bot.login();
- Log.i("登陆成功");
- isLogin = true;
- isInit = true;
- new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- com.yutou.bilibili.Tools.Log.e(e);
- }
- String str = sendMessage("姬妻酱上线拉~");
- Log.i(str);
-
+ }
+ });
+ //Events.registerEvents(bot, new MessageListener());
+ GlobalEventChannel.INSTANCE.subscribeAlways(GroupMessageEvent.class, new MessageListener());
+ Log.i("准备登陆");
+ bot.login();
+ Log.i("登陆成功");
+ isLogin = true;
+ isInit = true;
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ Log.e(e);
}
- }).start();
- bot.join();
+ String str = sendMessage("姬妻酱上线拉~");
+ Log.i(str);
+
+ }
+ }).start();
+ bot.join();
- }
}).start();
}
@@ -256,7 +253,7 @@ public class QQBotManager implements ApplicationContextAware {
getInstance().sendMessage("正在重启服务");
System.out.println("结束进程");
try {
- AppTools.exec("cd /media/yutou/4t/public/servier/biliob && ./start.sh");
+ AppTools.exec("cd /home/yutou/public/servier/biliob && ./start.sh");
} catch (Exception e) {
e.printStackTrace();
}