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