diff --git a/pom.xml b/pom.xml
index b688616..62cfeda 100644
--- a/pom.xml
+++ b/pom.xml
@@ -148,6 +148,27 @@
org.springframework.boot
spring-boot-maven-plugin
+
+
+ ZIP
+
+ com.yutou.bilibili.BilibiliApplication
+
+
+
+ package
+
+ repackage
+
+
+
+
+ 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 419bdb7..f286260 100644
--- a/src/main/java/com/yutou/bilibili/BiliBili/Live.java
+++ b/src/main/java/com/yutou/bilibili/BiliBili/Live.java
@@ -58,8 +58,9 @@ public class Live implements ApplicationContextAware {
}
public Live() {
- if (applicationContext != null)
+ if (applicationContext != null) {
service = getBean(IBiliBiliLiveService.class);
+ }
info = new BilibiliLiveInfo();
info.setGiftuser(0);
info.setPopular(0);
@@ -74,6 +75,10 @@ public class Live implements ApplicationContextAware {
* @param isLogin 是否登录用户
*/
public void add(int roomId, boolean isLogin) {
+ if(Live.lives.contains(this)){
+ Log.i("已经在统计:"+roomId);
+ return;
+ }
this.roomId = roomId;
this.isLogin = isLogin;
upData = new BilibiliUpInfo();
@@ -205,6 +210,7 @@ public class Live implements ApplicationContextAware {
com.yutou.bilibili.Tools.Log.i("code = " + code + ", reason = " + reason + ", remote = " + remote);
run = false;
client.close();
+ stop();
}
@Override
@@ -212,6 +218,7 @@ public class Live implements ApplicationContextAware {
Log.e(e);
run = false;
client.close();
+ stop();
}
};
client.connect();
@@ -227,11 +234,11 @@ public class Live implements ApplicationContextAware {
if (SaveLive.getInstance().checkLive(roomId)) {
SaveLive.getInstance().stop(roomId);
}
- Live.lives.remove(this);
- com.yutou.bilibili.Tools.Log.i("退出" + roomId + "直播间");
if (checkLiveTimer != null) {
checkLiveTimer.cancel();
}
+ Live.lives.remove(this);
+ com.yutou.bilibili.Tools.Log.i("退出" + roomId + "直播间");
}
/**
@@ -360,8 +367,9 @@ public class Live implements ApplicationContextAware {
danmuData.setUname(infoData.getJSONArray(2).getString(1));
if (upData != null && upData.getSavedanmu() == 1) {
- if (danmuManager != null)
+ if (danmuManager != null) {
danmuManager.addDanmu(danmuData);
+ }
}
Log.i(AppTools.getToDayTimeToString(startTime),roomId,danmu);
break;
@@ -509,6 +517,7 @@ public class Live implements ApplicationContextAware {
case "PK_BATTLE_SETTLE":
case "PK_BATTLE_PRE_NEW":
case "PK_BATTLE_PRE":
+ case "STOP_LIVE_ROOM_LIST"://不知道是啥,停止直播?
//com.yutou.bilibili.Tools.Log.i(msg);
@@ -579,6 +588,7 @@ public class Live implements ApplicationContextAware {
}
+ @Override
public void run() {
if (!run) {
cancel();
diff --git a/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java b/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java
index f77b6ca..a481e9a 100644
--- a/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java
+++ b/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java
@@ -49,7 +49,7 @@ public class QQBotManager implements ApplicationContextAware {
private static class QQCommands {
private final static String QQ_HELP = "!help";
private final static String QQ_SYSTEM_LOG = "!log";
- private final static String QQ_SYSTEM_STOP = "!stopliveservice";
+ private final static String QQ_SYSTEM_RESTART = "!restart";
private final static String QQ_GET_IP = "!ip";
private final static String QQ_GET_VERSION = "!version";
private final static String QQ_LIVE_LIST = "!列表";
@@ -250,10 +250,14 @@ public class QQBotManager implements ApplicationContextAware {
case QQCommands.QQ_GET_VERSION:
sendVersion();
break;
- case QQCommands.QQ_SYSTEM_STOP:
- getInstance().sendMessage("正在停止服务");
+ case QQCommands.QQ_SYSTEM_RESTART:
+ getInstance().sendMessage("正在重启服务");
System.out.println("结束进程");
- System.exit(0);
+ try {
+ AppTools.exec("cd /media/yutou/4t/public/servier/biliob && ./start.sh");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
break;
case QQCommands.QQ_LIVE_LIST:
builder.append("当前正在记录数据的直播间:");