This commit is contained in:
Yutousama 2021-05-20 21:16:02 +08:00
parent d3a3a6e6ba
commit 953f1336a8
6 changed files with 16 additions and 6 deletions

View File

@ -174,6 +174,7 @@ public class Live implements ApplicationContextAware {
heartBeattimer.schedule(new sendHeartbeat(), 2000, 20000); heartBeattimer.schedule(new sendHeartbeat(), 2000, 20000);
init = false; init = false;
} }
Log.i(AppTools.getToDayTimeToString(startTime),roomId,LiveUtils.getHex(bytes.array()).substring(0,16));
decompress(bytes.array()); decompress(bytes.array());
} }
@ -331,7 +332,7 @@ public class Live implements ApplicationContextAware {
* @param msg 数据json * @param msg 数据json
* @param bytes 原始hex数据 * @param bytes 原始hex数据
*/ */
public synchronized void processData(String msg, byte[] bytes) { public void processData(String msg, byte[] bytes) {
try { try {
JSONObject json = JSONObject.parseObject(msg); JSONObject json = JSONObject.parseObject(msg);
JSONObject data; JSONObject data;

View File

@ -52,6 +52,9 @@ public class LiveUtils {
} }
} }
} }
public static String getHex(byte[] bytes){
return DatatypeConverter.printHexBinary(bytes);
}
public static byte[] dec(byte[] data) { public static byte[] dec(byte[] data) {
byte[] output = new byte[0]; byte[] output = new byte[0];

View File

@ -66,8 +66,9 @@ public class BiliBiliLiveServiceImpl implements IBiliBiliLiveService {
@Override @Override
public BilibiliUpInfo queryUp(BilibiliUpInfo data) { public BilibiliUpInfo queryUp(BilibiliUpInfo data) {
if (data.getRoomid() == null) if (data.getRoomid() == null) {
return null; return null;
}
return queryUpToRoomId(data.getRoomid()); return queryUpToRoomId(data.getRoomid());
} }
@ -124,6 +125,7 @@ public class BiliBiliLiveServiceImpl implements IBiliBiliLiveService {
if (!isLive()) { if (!isLive()) {
return false; return false;
} }
return liveDataDao.insert(data) > 0; return liveDataDao.insert(data) > 0;
} }
@ -235,7 +237,7 @@ public class BiliBiliLiveServiceImpl implements IBiliBiliLiveService {
public boolean isLive() { public boolean isLive() {
String flag = configService.getConfig(Config.BILI_LIVE_FLAG); String flag = configService.getConfig(Config.BILI_LIVE_FLAG);
if (flag != null) { if (flag != null) {
return !flag.equals("0"); return !"0".equals(flag);
} }
return true; return true;
} }

View File

@ -13,7 +13,7 @@ import org.springframework.context.annotation.Import;
@SpringBootApplication @SpringBootApplication
public class BilibiliApplication { public class BilibiliApplication {
public static String version="0.7"; public static String version="0.7.1";
public static void main(String[] args) { public static void main(String[] args) {
QQBotManager.getInstance().init(); QQBotManager.getInstance().init();

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yutou.bilibili.BiliBili.Live; import com.yutou.bilibili.BiliBili.Live;
import com.yutou.bilibili.BiliBili.LiveUtils;
import com.yutou.bilibili.BiliBili.Tools.LiveT; import com.yutou.bilibili.BiliBili.Tools.LiveT;
import com.yutou.bilibili.BiliBili.Tools.SaveLive; import com.yutou.bilibili.BiliBili.Tools.SaveLive;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -29,6 +30,7 @@ public class TestController {
JSONObject item=new JSONObject(); JSONObject item=new JSONObject();
item.put("info", JSON.toJSON(live.getInfo())); item.put("info", JSON.toJSON(live.getInfo()));
item.put("data",JSON.toJSON(live.geData())); item.put("data",JSON.toJSON(live.geData()));
item.put("isLive", LiveUtils.isLivePlayer(live.getInfo().getRoomid()));
array.add(item); array.add(item);
} }
json.put("array",array); json.put("array",array);

View File

@ -10,8 +10,9 @@ import java.util.logging.Logger;
public class Log { public class Log {
private static Logger logger; private static Logger logger;
public static void i(Object log) { public static void i(Object log) {
if (!((boolean) ConfigTools.load(ConfigTools.CONFIG, "logout"))) if (!((boolean) ConfigTools.load(ConfigTools.CONFIG, "logout"))) {
return; return;
}
System.out.printf("[%s]%s%n", System.out.printf("[%s]%s%n",
AppTools.getToDayNowTimeToString(), AppTools.getToDayNowTimeToString(),
log log
@ -20,8 +21,9 @@ public class Log {
} }
public static void e(Exception e) { public static void e(Exception e) {
if (!((boolean) ConfigTools.load(ConfigTools.CONFIG, "logout"))) if (!((boolean) ConfigTools.load(ConfigTools.CONFIG, "logout"))) {
return; return;
}
i(e.getMessage()); i(e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }