diff --git a/CHANGELOG.md b/CHANGELOG.md
index 10d7d1c9..f2d06c6c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,10 @@
4.4.4
========================
* Fixed Camsoda token label
+* Removed Camsoda Shows Tab
+* Added Chaturbate configuration parameter to throttle requests to avoid
+ 429 errors. Be aware that this also slows down the online check for Chaturbate
+ models, especially, if you have a lot of models in your list.
4.4.3
========================
diff --git a/client/pom.xml b/client/pom.xml
index c4dc94a5..82dc6479 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -8,7 +8,7 @@
ctbrec
master
- 4.4.3
+ 4.4.4
../master
diff --git a/client/src/main/java/ctbrec/ui/sites/chaturbate/ChaturbateConfigUi.java b/client/src/main/java/ctbrec/ui/sites/chaturbate/ChaturbateConfigUi.java
index 3a6eeead..6c07551a 100644
--- a/client/src/main/java/ctbrec/ui/sites/chaturbate/ChaturbateConfigUi.java
+++ b/client/src/main/java/ctbrec/ui/sites/chaturbate/ChaturbateConfigUi.java
@@ -84,6 +84,26 @@ public class ChaturbateConfigUi extends AbstractConfigUI {
GridPane.setColumnSpan(baseUrl, 2);
layout.add(baseUrl, 1, row++);
+ layout.add(new Label("Time between requests (ms)"), 0, row);
+ var requestThrottle = new TextField(Integer.toString(Config.getInstance().getSettings().chaturbateMsBetweenRequests));
+ requestThrottle.textProperty().addListener((ob, o, n) -> {
+ int newValue = -1;
+ try {
+ newValue = Integer.parseInt(n);
+ } catch (Exception e) {
+ requestThrottle.setText(o);
+ return;
+ }
+ if (newValue != Config.getInstance().getSettings().chaturbateMsBetweenRequests) {
+ Config.getInstance().getSettings().chaturbateMsBetweenRequests = newValue;
+ save();
+ }
+ });
+ GridPane.setFillWidth(requestThrottle, true);
+ GridPane.setHgrow(requestThrottle, Priority.ALWAYS);
+ GridPane.setColumnSpan(requestThrottle, 2);
+ layout.add(requestThrottle, 1, row++);
+
var createAccount = new Button("Create new Account");
createAccount.setOnAction(e -> DesktopIntegration.open(Chaturbate.REGISTRATION_LINK));
layout.add(createAccount, 1, row);
@@ -91,6 +111,7 @@ public class ChaturbateConfigUi extends AbstractConfigUI {
GridPane.setMargin(username, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
GridPane.setMargin(password, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
GridPane.setMargin(baseUrl, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
+ GridPane.setMargin(requestThrottle, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
GridPane.setMargin(createAccount, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
username.setPrefWidth(300);
diff --git a/common/pom.xml b/common/pom.xml
index d9e1f9dc..7762728b 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -8,7 +8,7 @@
ctbrec
master
- 4.4.3
+ 4.4.4
../master
diff --git a/common/src/main/java/ctbrec/Settings.java b/common/src/main/java/ctbrec/Settings.java
index 455e32b4..aa05d35c 100644
--- a/common/src/main/java/ctbrec/Settings.java
+++ b/common/src/main/java/ctbrec/Settings.java
@@ -43,6 +43,7 @@ public class Settings {
TIME_OR_SIZE
}
+
public String amateurTvUsername = "";
public String amateurTvPassword = "";
public String bongacamsBaseUrl = "https://bongacams.com";
@@ -55,6 +56,7 @@ public class Settings {
public String chaturbatePassword = "";
public String chaturbateUsername = "";
public String chaturbateBaseUrl = "https://chaturbate.com";
+ public int chaturbateMsBetweenRequests = 1000;
public boolean chooseStreamQuality = false;
public String colorAccent = "#FFFFFF";
public String colorBase = "#FFFFFF";
diff --git a/common/src/main/java/ctbrec/sites/chaturbate/ChaturbateHttpClient.java b/common/src/main/java/ctbrec/sites/chaturbate/ChaturbateHttpClient.java
index 90dcab04..71f9256c 100644
--- a/common/src/main/java/ctbrec/sites/chaturbate/ChaturbateHttpClient.java
+++ b/common/src/main/java/ctbrec/sites/chaturbate/ChaturbateHttpClient.java
@@ -152,7 +152,7 @@ public class ChaturbateHttpClient extends HttpClient {
}
private static void acquireSlot() throws InterruptedException {
- long pauseBetweenRequests = 500;
+ long pauseBetweenRequests = Config.getInstance().getSettings().chaturbateMsBetweenRequests;
requestThrottle.acquire();
long now = System.currentTimeMillis();
long millisSinceLastRequest = now - lastRequest;
diff --git a/common/src/main/java/ctbrec/sites/chaturbate/ChaturbateModel.java b/common/src/main/java/ctbrec/sites/chaturbate/ChaturbateModel.java
index 9a9cd01f..9587f4c5 100644
--- a/common/src/main/java/ctbrec/sites/chaturbate/ChaturbateModel.java
+++ b/common/src/main/java/ctbrec/sites/chaturbate/ChaturbateModel.java
@@ -45,7 +45,6 @@ public class ChaturbateModel extends AbstractModel { // NOSONAR
private static final Logger LOG = LoggerFactory.getLogger(ChaturbateModel.class);
private int[] resolution = new int[2];
private transient StreamInfo streamInfo;
- private long streamInfoTimestamp = 0;
/**
* This constructor exists only for deserialization. Please don't call it directly
@@ -261,12 +260,6 @@ public class ChaturbateModel extends AbstractModel { // NOSONAR
}
private StreamInfo loadStreamInfo() throws IOException, InterruptedException {
- long now = System.currentTimeMillis();
- long streamInfoAge = now - streamInfoTimestamp;
- if (streamInfo != null && streamInfoAge < 5000) {
- return streamInfo;
- }
-
RequestBody body = new FormBody.Builder()
.add("room_slug", getName())
.add("bandwidth", "high")
@@ -284,7 +277,6 @@ public class ChaturbateModel extends AbstractModel { // NOSONAR
Moshi moshi = new Moshi.Builder().build();
JsonAdapter adapter = moshi.adapter(StreamInfo.class);
streamInfo = adapter.fromJson(content);
- streamInfoTimestamp = System.currentTimeMillis();
return streamInfo;
} else {
int code = response.code();
diff --git a/master/pom.xml b/master/pom.xml
index 0e50e9cf..a7c5578a 100644
--- a/master/pom.xml
+++ b/master/pom.xml
@@ -6,7 +6,7 @@
ctbrec
master
pom
- 4.4.3
+ 4.4.4
../common
diff --git a/server/pom.xml b/server/pom.xml
index 4031cea8..6e774be7 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -8,7 +8,7 @@
ctbrec
master
- 4.4.3
+ 4.4.4
../master
diff --git a/server/src/main/java/ctbrec/recorder/server/ConfigServlet.java b/server/src/main/java/ctbrec/recorder/server/ConfigServlet.java
index ec3c8f8d..39a618ef 100644
--- a/server/src/main/java/ctbrec/recorder/server/ConfigServlet.java
+++ b/server/src/main/java/ctbrec/recorder/server/ConfigServlet.java
@@ -49,6 +49,7 @@ public class ConfigServlet extends AbstractCtbrecServlet {
JSONArray json = new JSONArray();
addParameter("concurrentRecordings", "Concurrent Recordings", DataType.INTEGER, settings.concurrentRecordings, json);
+ addParameter("chaturbateMsBetweenRequests", "Chaturbate time between requests (ms)", DataType.INTEGER, settings.chaturbateMsBetweenRequests, json);
addParameter("ffmpegFileSuffix", "File Suffix", DataType.STRING, settings.ffmpegFileSuffix, json);
addParameter("ffmpegMergedDownloadArgs", "FFmpeg Parameters", DataType.STRING, settings.ffmpegMergedDownloadArgs, json);
addParameter("httpPort", "HTTP port", DataType.INTEGER, settings.httpPort, json);