修复直播状态

This commit is contained in:
Yutousama 2022-04-11 19:16:17 +08:00
parent addda76eaa
commit e68bef1f5d

View File

@ -299,9 +299,9 @@ public class Live implements ApplicationContextAware {
if (data.length > 32) { if (data.length > 32) {
List<String> list = LiveUtils.getMsgList(LiveUtils.dec(bytes), new ArrayList<>(), true); List<String> list = LiveUtils.getMsgList(LiveUtils.dec(bytes), new ArrayList<>(), true);
String tmp = ""; String tmp = "";
for (int i=0;i<list.size();i++) { for (int i = 0; i < list.size(); i++) {
processData(list.get(i), data); processData(list.get(i), data);
tmp +="|||"+i+"[start] "+ list.get(i)+ " [end]||| "; tmp += "|||" + i + "[start] " + list.get(i) + " [end]||| ";
} }
// Log.i(AppTools.getToDayTimeToString(startTime), roomId, "list size = " + list.size() + " data = " + tmp); // Log.i(AppTools.getToDayTimeToString(startTime), roomId, "list size = " + list.size() + " data = " + tmp);
} else { } else {
@ -313,8 +313,8 @@ public class Live implements ApplicationContextAware {
int popular = LiveUtils.bytesToInt2(bytes, 0); int popular = LiveUtils.bytesToInt2(bytes, 0);
info.setPopular(popular); info.setPopular(popular);
} }
upData.setLive(LiveUtils.getLiveState(roomId)?1:0);
} }
upData.setLive(LiveUtils.getLiveState(roomId) ? 1 : 0);
} catch (Exception e) { } catch (Exception e) {
Log.e(e); Log.e(e);
@ -327,7 +327,7 @@ public class Live implements ApplicationContextAware {
public void checkLive() { public void checkLive() {
boolean isLive = LiveUtils.isLivePlayer(roomId); boolean isLive = LiveUtils.isLivePlayer(roomId);
if(SaveLive.getInstance().checkLive(roomId)){ if (SaveLive.getInstance().checkLive(roomId)) {
return; return;
} }
if (isLive && upData.getSavelive() == 1) { if (isLive && upData.getSavelive() == 1) {
@ -348,7 +348,7 @@ public class Live implements ApplicationContextAware {
* @param bytes 原始hex数据 * @param bytes 原始hex数据
*/ */
public void processData(String msg, byte[] bytes) { public void processData(String msg, byte[] bytes) {
if(msg.contains("[object Object]")){ if (msg.contains("[object Object]")) {
return; return;
} }
try { try {
@ -357,7 +357,7 @@ public class Live implements ApplicationContextAware {
BilibiliLiveData liveData = new BilibiliLiveData(); BilibiliLiveData liveData = new BilibiliLiveData();
String danmu; String danmu;
GiftData giftData; GiftData giftData;
Log.i(AppTools.getToDayTime(),roomId,json.toJSONString()); Log.i(AppTools.getToDayTime(), roomId, json.toJSONString());
switch (json.getString("cmd")) { switch (json.getString("cmd")) {
case "INTERACT_WORD"://普通用户进直播间 case "INTERACT_WORD"://普通用户进直播间
danmu = json.getJSONObject("data").getString("uname") + " 进入到直播间"; danmu = json.getJSONObject("data").getString("uname") + " 进入到直播间";
@ -537,7 +537,7 @@ public class Live implements ApplicationContextAware {
//com.yutou.bilibili.Tools.Log.i(msg); //com.yutou.bilibili.Tools.Log.i(msg);
break; break;
default: default:
com.yutou.bilibili.Tools.Log.i("["+roomId+"]"+msg); com.yutou.bilibili.Tools.Log.i("[" + roomId + "]" + msg);
liveData = new BilibiliLiveData(); liveData = new BilibiliLiveData();
liveData.setType(LiveData.UNKNOWN_MESSAGE); liveData.setType(LiveData.UNKNOWN_MESSAGE);
liveData.setUid(-1); liveData.setUid(-1);
@ -549,7 +549,7 @@ public class Live implements ApplicationContextAware {
checkLive(); checkLive();
} catch (Exception e) { } catch (Exception e) {
Log.e(e); Log.e(e);
Log.i("msg = "+msg); Log.i("msg = " + msg);
// Log.i(AppTools.getToDayTimeToString(startTime), roomId, e.getLocalizedMessage()); // Log.i(AppTools.getToDayTimeToString(startTime), roomId, e.getLocalizedMessage());
/*try { /*try {
JSONObject.parseObject(new String(bytes, StandardCharsets.UTF_8)); JSONObject.parseObject(new String(bytes, StandardCharsets.UTF_8));