From 5a23d95a4b2ed509795ba9350239b87fe1fb81e3 Mon Sep 17 00:00:00 2001 From: reusedname <155286845+reusedname@users.noreply.github.com> Date: Sun, 2 Mar 2025 13:34:42 +0500 Subject: [PATCH] Improve Bongacams online check - check new (?) field isOnline before attempting to get stream sources (was failing due to missing json field when offline) --- .../ctbrec/sites/bonga/BongaCamsModel.java | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/common/src/main/java/ctbrec/sites/bonga/BongaCamsModel.java b/common/src/main/java/ctbrec/sites/bonga/BongaCamsModel.java index 839b4068..9f10abd6 100644 --- a/common/src/main/java/ctbrec/sites/bonga/BongaCamsModel.java +++ b/common/src/main/java/ctbrec/sites/bonga/BongaCamsModel.java @@ -64,22 +64,30 @@ public class BongaCamsModel extends AbstractModel { setDisplayName(performerData.optString("displayName")); String chatType = performerData.optString("showType"); boolean isAway = performerData.optBoolean("isAway"); + + // looks like isOnline key is new. Treat it's absence as true (old behavior) + boolean jsonIsOnline = performerData.optBoolean("isOnline", true); - onlineState = mapState(chatType); - if (onlineState == ONLINE) { - if (isStreamAvailable()) { - if (isAway) { - onlineState = AWAY; - online = false; + if (!jsonIsOnline) { + onlineState = OFFLINE; + online = false; + } else { + onlineState = mapState(chatType); + if (onlineState == ONLINE) { + if (isStreamAvailable()) { + if (isAway) { + onlineState = AWAY; + online = false; + } else { + online = true; + } } else { - online = true; + online = false; + onlineState = AWAY; } } else { online = false; - onlineState = AWAY; } - } else { - online = false; } return online; }