From 2fdc30fd46e707070fbd42db2ae04d06b4113270 Mon Sep 17 00:00:00 2001 From: jafea7 Date: Mon, 5 May 2025 23:08:33 +1000 Subject: [PATCH] Update StripchatModel.java --- .../sites/stripchat/StripchatModel.java | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/common/src/main/java/ctbrec/sites/stripchat/StripchatModel.java b/common/src/main/java/ctbrec/sites/stripchat/StripchatModel.java index 450c3aec..2a00d785 100644 --- a/common/src/main/java/ctbrec/sites/stripchat/StripchatModel.java +++ b/common/src/main/java/ctbrec/sites/stripchat/StripchatModel.java @@ -48,25 +48,30 @@ public class StripchatModel extends AbstractModel { @Override public boolean isOnline(boolean ignoreCache) throws IOException, ExecutionException, InterruptedException { - JSONObject info = getModelInfo(); - if (ignoreCache && info.has("user")) { - JSONObject user = info.getJSONObject("user").getJSONObject("user"); - if (info.has("cam")) { - JSONObject cam = info.getJSONObject("cam"); + if (ignoreCache) { + JSONObject jsonResponse = getModelInfo(); + if (jsonResponse.has("user")) { + JSONObject user = jsonResponse.getJSONObject("user").getJSONObject("user"); + String status = user.optString("status"); + mapOnlineState(status); + if (onlineState == OFFLINE) { + setLastSeen(user.optString("statusChangedAt")); + } + if (isBanned(user)) { + log.debug("Model inactive or deleted: {}", getName()); + setMarkedForLaterRecording(true); + } + if ((onlineState == PRIVATE) && jsonResponse.has("cam")) { + JSONObject cam = jsonResponse.getJSONObject("cam"); + if (StringUtil.isNotBlank(cam.optString(KEY_MODEL_TOKEN))) { + setOnlineState(ONLINE); + return true; + } + } } - String status = user.optString("status"); - mapOnlineState(status); - if (onlineState == OFFLINE) { - setLastSeen(user.optString("statusChangedAt")); - } - if (isBanned(user)) { - log.debug("Model inactive or deleted: {}", getName()); - // Config.getInstance().setModelNotes(this, "Model inactive or deleted"); <- from v5.0.24 + if (jsonResponse.optString("error").equals("Not Found")) { setMarkedForLaterRecording(true); - } - if (onlineState == PRIVATE && StringUtil.isNotBlank((cam.optString(KEY_MODEL_TOKEN))) { - setOnlineState(ONLINE); - return true; + setOnlineState(OFFLINE); } } return onlineState == ONLINE;