Update StripchatModel.java

This commit is contained in:
jafea7 2025-05-05 23:08:33 +10:00
parent 5c89e9e1bc
commit 2fdc30fd46
1 changed files with 22 additions and 17 deletions

View File

@ -48,12 +48,10 @@ 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) {
@ -61,14 +59,21 @@ public class StripchatModel extends AbstractModel {
}
if (isBanned(user)) {
log.debug("Model inactive or deleted: {}", getName());
// Config.getInstance().setModelNotes(this, "Model inactive or deleted"); <- from v5.0.24
setMarkedForLaterRecording(true);
}
if (onlineState == PRIVATE && StringUtil.isNotBlank((cam.optString(KEY_MODEL_TOKEN))) {
if ((onlineState == PRIVATE) && jsonResponse.has("cam")) {
JSONObject cam = jsonResponse.getJSONObject("cam");
if (StringUtil.isNotBlank(cam.optString(KEY_MODEL_TOKEN))) {
setOnlineState(ONLINE);
return true;
}
}
}
if (jsonResponse.optString("error").equals("Not Found")) {
setMarkedForLaterRecording(true);
setOnlineState(OFFLINE);
}
}
return onlineState == ONLINE;
}