forked from j62/ctbrec
1
0
Fork 0

Distinguish between performer_id and display_name for LiveJasmin models

This commit is contained in:
0xb00bface 2020-08-09 11:04:24 +02:00
parent b6e4bad837
commit ee302e49a4
4 changed files with 26 additions and 5 deletions

View File

@ -1,3 +1,14 @@
3.8.5
========================
* Fixed Stripchat followed tab. It didn't work, if you have many favorited
models
* Fixed: Some Stripchat models didn't get recorded
* Fixed: Some LiveJasmin models didn't get recorded
* Added support for temporary recordings. On the recording tab you can now set
a date, when to stop recording a model and what to do afterwards
(pause or remove remove the model)
* Changed the look of the of the model table in the web interface a bit
3.8.4 3.8.4
======================== ========================
* Added support for xHamsterLive (go to Settings -> Sites -> Stripchat, * Added support for xHamsterLive (go to Settings -> Sites -> Stripchat,

View File

@ -141,8 +141,6 @@ public class CamrecApplication extends Application {
} }
private void startOnlineMonitor() { private void startOnlineMonitor() {
onlineMonitor = new OnlineMonitor(recorder);
onlineMonitor.start();
for (Site site : sites) { for (Site site : sites) {
if(site.isEnabled()) { if(site.isEnabled()) {
try { try {
@ -153,6 +151,8 @@ public class CamrecApplication extends Application {
} }
} }
} }
onlineMonitor = new OnlineMonitor(recorder);
onlineMonitor.start();
} }
private void logEnvironment() { private void logEnvironment() {

View File

@ -5,6 +5,7 @@ import static ctbrec.io.HttpConstants.*;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -13,6 +14,8 @@ import java.util.regex.Pattern;
import org.json.JSONObject; import org.json.JSONObject;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ctbrec.Config; import ctbrec.Config;
import ctbrec.Model; import ctbrec.Model;
@ -27,6 +30,7 @@ import okhttp3.Response;
public class LiveJasmin extends AbstractSite { public class LiveJasmin extends AbstractSite {
private static final Logger LOG = LoggerFactory.getLogger(LiveJasmin.class);
public static String baseUrl = ""; public static String baseUrl = "";
public static String baseDomain = ""; public static String baseDomain = "";
private HttpClient httpClient; private HttpClient httpClient;
@ -169,7 +173,8 @@ public class LiveJasmin extends AbstractSite {
} }
return models; return models;
} else { } else {
throw new IOException("Response was not successful: " + url + "\n" + body); LOG.debug("Response was not successful: {}\n{}", url, body);
return Collections.emptyList();
} }
} else { } else {
throw new HttpException(response.code(), response.message()); throw new HttpException(response.code(), response.message());
@ -198,7 +203,7 @@ public class LiveJasmin extends AbstractSite {
String name = m.group(1); String name = m.group(1);
return createModel(name); return createModel(name);
} }
m = Pattern.compile("http.*?livejasmin\\.com.*?/chat-html5/(.*)").matcher(url); m = Pattern.compile("http.*?livejasmin\\.com.*?/chat(?:-html5)?/(.*)").matcher(url);
if(m.find()) { if(m.find()) {
String name = m.group(1); String name = m.group(1);
return createModel(name); return createModel(name);

View File

@ -72,6 +72,8 @@ public class LiveJasminModel extends AbstractModel {
JSONObject config = data.getJSONObject("config"); JSONObject config = data.getJSONObject("config");
JSONObject chatRoom = config.getJSONObject("chatRoom"); JSONObject chatRoom = config.getJSONObject("chatRoom");
setId(chatRoom.getString("p_id")); setId(chatRoom.getString("p_id"));
setName(chatRoom.getString("performer_id"));
setDisplayName(chatRoom.getString("display_name"));
if (chatRoom.has("profile_picture_url")) { if (chatRoom.has("profile_picture_url")) {
setPreview(chatRoom.getString("profile_picture_url")); setPreview(chatRoom.getString("profile_picture_url"));
} }
@ -80,11 +82,14 @@ public class LiveJasminModel extends AbstractModel {
if (chatRoom.optInt("is_on_private", 0) == 1) { if (chatRoom.optInt("is_on_private", 0) == 1) {
onlineState = State.PRIVATE; onlineState = State.PRIVATE;
} }
if (chatRoom.optInt("is_video_call_enabled", 0) == 1) {
onlineState = State.PRIVATE;
}
resolution = new int[2]; resolution = new int[2];
resolution[0] = config.optInt("streamWidth"); resolution[0] = config.optInt("streamWidth");
resolution[1] = config.optInt("streamHeight"); resolution[1] = config.optInt("streamHeight");
online = onlineState == State.ONLINE; online = onlineState == State.ONLINE;
LOG.trace("{} - status:{} {} {} {}", getName(), online, onlineState, Arrays.toString(resolution), getUrl()); LOG.trace("{} - status:{} {} {} {} {}", getName(), online, onlineState, Arrays.toString(resolution), getUrl(), id);
} else { } else {
throw new IOException("Response was not successful: " + body); throw new IOException("Response was not successful: " + body);
} }