Compare commits

..

No commits in common. "5731d80f7feff09b6837520fa1aaff9a479f0666" and "64ddf4977e776002c550ef7329d4f39522ca8e20" have entirely different histories.

9 changed files with 108 additions and 122 deletions

View File

@ -11,12 +11,6 @@ If this version doesn't do what you want, don't use it ... simple.
Changes from 0xb00bface's v5.3.0 version. Changes from 0xb00bface's v5.3.0 version.
25.09.13
========================
* Sort entries in site tabs: Tracked->Bookmarked
* Add Discord button to Settings->Help
* Implemnt CheckURL dialog from WinkRU v5.0.24
25.09.10 (fix stream playback) 25.09.10 (fix stream playback)
======================== ========================
* SC encrypted stream fix (credit @Gabi_uy) * SC encrypted stream fix (credit @Gabi_uy)

View File

@ -8,7 +8,7 @@
<parent> <parent>
<groupId>ctbrec</groupId> <groupId>ctbrec</groupId>
<artifactId>master</artifactId> <artifactId>master</artifactId>
<version>25.9.13</version> <version>25.9.10</version>
<relativePath>../master</relativePath> <relativePath>../master</relativePath>
</parent> </parent>

View File

@ -75,6 +75,46 @@ public class Player {
return play(model, true); return play(model, true);
} }
// Precompile VR suffix regex
// private static final Pattern VR_SUFFIX = Pattern.compile("(_vr)$");
// Map of host replacements for non-VR streams
/* private static final Map<String, String> HOST_REPLACEMENTS = Map.of(
"media-hls.doppiocdn.com", "media-hls.saawsedge.com"
); */
/**
* Rewrites non-VR doppiocdn.com URLs:
* - swaps host
* - strips _vr from directory if present
* - forces _480p resolution
*/
/* private static String rewriteNonVrStripchatUrl(String url) {
try {
URI u = URI.create(url);
String host = u.getHost();
if (host != null && host.contains("doppiocdn.com")) {
String newHost = HOST_REPLACEMENTS.getOrDefault(host, host);
// Split the path: /b-hls-02/89673378/89673378_720p60.m3u8
String[] parts = u.getPath().split("/");
if (parts.length >= 4) {
String dir1 = parts[1]; // e.g., b-hls-02
String dir2 = VR_SUFFIX.matcher(parts[2]).replaceAll(""); // strip _vr if present
String newFile = dir2 + "_480p.m3u8"; // force 480p
String rewritten = String.format("https://%s/%s/%s/%s", newHost, dir1, dir2, newFile);
log.trace("Rewrote non-VR Stripchat URL: {} -> {}", url, rewritten);
return rewritten;
}
}
} catch (Exception ex) {
log.warn("Failed to rewrite Stripchat URL {}: {}", url, ex.toString());
}
return url;
} */
public static boolean play(Model model, boolean async) { public static boolean play(Model model, boolean async) {
try { try {
if (model.isOnline(true)) { if (model.isOnline(true)) {
@ -199,9 +239,14 @@ public class Player {
String mediaUrlForPlayer = upstreamUrl; String mediaUrlForPlayer = upstreamUrl;
if (looksLikeStripchatM3u8(upstreamUrl)) { if (looksLikeStripchatM3u8(upstreamUrl)) {
// if (isVrStripchatStream(upstreamUrl)) {
// VR stream -> use proxy
proxy = new LocalHlsProxy(model, upstreamUrl); proxy = new LocalHlsProxy(model, upstreamUrl);
proxy.start(); proxy.start();
mediaUrlForPlayer = proxy.localUrl(); mediaUrlForPlayer = proxy.localUrl();
// } else if (upstreamUrl.contains("doppiocdn.com")) {
// Non-VR -> rewrite host + resolution
// mediaUrlForPlayer = rewriteNonVrStripchatUrl(upstreamUrl);
} }
Object[] cmdline = createCmdline(mediaUrlForPlayer, model); Object[] cmdline = createCmdline(mediaUrlForPlayer, model);
@ -269,6 +314,24 @@ public class Player {
} }
} }
/**
* Returns true if the URL is a VR doppiocdn.com stream (.m3u8 + _vr)
*/
private boolean isVrStripchatStream(String url) {
try {
URI u = URI.create(url);
String host = u.getHost();
String path = u.getPath().toLowerCase(Locale.ROOT);
return host != null
&& host.contains("doppiocdn.com")
&& path.endsWith(".m3u8")
&& path.contains("_vr");
} catch (Throwable ignore) {
return false;
}
}
private boolean looksLikeStripchatM3u8(String url) { private boolean looksLikeStripchatM3u8(String url) {
try { try {
URL u = new URL(url); URL u = new URL(url);

View File

@ -1,15 +1,15 @@
package ctbrec.ui.action; package ctbrec.ui.action;
import ctbrec.GlobalThreadPool;
import ctbrec.Model;
import ctbrec.recorder.Recorder;
import ctbrec.ui.action.StopRecordingAction;
import ctbrec.ui.controls.Dialogs;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import ctbrec.GlobalThreadPool;
import ctbrec.Model;
import ctbrec.recorder.Recorder;
import ctbrec.ui.controls.Dialogs;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -17,7 +17,9 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j @Slf4j
public class CheckModelAccountAction { public class CheckModelAccountAction {
private Button b; private Button b;
private Recorder recorder; private Recorder recorder;
private String buttonText; private String buttonText;
public CheckModelAccountAction(Button b, Recorder recorder) { public CheckModelAccountAction(Button b, Recorder recorder) {
@ -28,30 +30,30 @@ public class CheckModelAccountAction {
public void execute(Predicate<Model> filter) { public void execute(Predicate<Model> filter) {
b.setDisable(true); b.setDisable(true);
Runnable checker = () -> { Runnable checker = (() -> {
ArrayList<Model> deletedAccounts = new ArrayList<Model>(); List<Model> deletedAccounts = new ArrayList<>();
try { try {
checkModelAccounts(filter, deletedAccounts); checkModelAccounts(filter, deletedAccounts);
} } finally {
finally {
showResult(deletedAccounts); showResult(deletedAccounts);
} }
}; });
GlobalThreadPool.submit((Runnable)checker); GlobalThreadPool.submit(checker);
} }
private void showResult(List<Model> deletedAccounts) { private void showResult(List<Model> deletedAccounts) {
Platform.runLater(() -> { Platform.runLater(() -> {
b.setDisable(false); b.setDisable(false);
b.setText(this.buttonText); b.setText(buttonText);
if (!deletedAccounts.isEmpty()) { if (!deletedAccounts.isEmpty()) {
StringBuilder sb = new StringBuilder(); var sb = new StringBuilder();
for (Model deletedModel : deletedAccounts) { for (Model deletedModel : deletedAccounts) {
Object name = deletedModel.getDisplayName() + " ".repeat(30); String name = deletedModel.getDisplayName() + " ".repeat(30);
name = ((String)name).substring(0, 30); name = name.substring(0, 30);
sb.append((String)name).append(' ').append('(').append(deletedModel.getUrl()).append(')').append('\n'); sb.append(name).append(' ').append('(').append(deletedModel.getUrl()).append(')').append('\n');
} }
boolean remove = Dialogs.showExpandedConfirmDialog("Deleted Accounts", "Accounts list:", sb.toString(), "The following accounts seem to have been deleted. Do you want to remove them?", b.getScene()); boolean remove = Dialogs.showConfirmDialog("Deleted Accounts", sb.toString(),
"The following accounts seem to have been deleted. Do you want to remove them?", b.getScene());
if (remove) { if (remove) {
new StopRecordingAction(b, deletedAccounts, recorder).execute(); new StopRecordingAction(b, deletedAccounts, recorder).execute();
} }
@ -60,21 +62,21 @@ public class CheckModelAccountAction {
} }
private void checkModelAccounts(Predicate<Model> filter, List<Model> deletedAccounts) { private void checkModelAccounts(Predicate<Model> filter, List<Model> deletedAccounts) {
List models = recorder.getModels().stream().filter(filter).collect(Collectors.toList()); List<Model> models = recorder.getModels().stream() //
.filter(filter) //
.collect(Collectors.toList());
int total = models.size(); int total = models.size();
for (int i = 0; i < total; ++i) { for (var i = 0; i < total; i++) {
int counter = i + 1; final int counter = i+1;
Platform.runLater(() -> b.setText(buttonText + " " + counter + "/" + total)); Platform.runLater(() -> b.setText(buttonText + ' ' + counter + '/' + total));
Model modelToCheck = (Model)models.get(i); var modelToCheck = models.get(i);
try { try {
if (modelToCheck.exists()) continue; if (!modelToCheck.exists()) {
deletedAccounts.add(modelToCheck); deletedAccounts.add(modelToCheck);
continue; }
} } catch (IOException e) {
catch (IOException e) { log.warn("Couldn't check, if model account still exists", e);
log.warn("Couldn't check, if model account still exists", (Throwable)e);
} }
} }
} }
} }

View File

@ -1,12 +1,6 @@
package ctbrec.ui.controls; package ctbrec.ui.controls;
import ctbrec.ui.AutosizeAlert; import ctbrec.ui.AutosizeAlert;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Collection;
import java.util.Objects;
import java.util.Optional;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ChangeListener;
import javafx.geometry.Insets; import javafx.geometry.Insets;
@ -15,7 +9,6 @@ import javafx.scene.control.*;
import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Alert.AlertType;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.layout.GridPane; import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region; import javafx.scene.layout.Region;
import javafx.stage.Modality; import javafx.stage.Modality;
import javafx.stage.Stage; import javafx.stage.Stage;
@ -36,68 +29,26 @@ public class Dialogs {
} }
public static void showError(String header, String text, Throwable t) { public static void showError(String header, String text, Throwable t) {
if (Objects.nonNull(t)) { showError(scene, header, text, t);
Dialogs.showError(scene, header, text, t);
} else {
Dialogs.showError(scene, header, text);
}
}
public static void showError(Scene parent, String header, String text) {
Runnable r = () -> {
AutosizeAlert alert = new AutosizeAlert(Alert.AlertType.ERROR, parent);
alert.setTitle("Error");
alert.setHeaderText(header);
alert.setContentText(text);
if (parent != null) {
Stage stage = (Stage)alert.getDialogPane().getScene().getWindow();
stage.getScene().getStylesheets().addAll((Collection<String>)parent.getStylesheets());
}
alert.showAndWait();
};
if (Platform.isFxApplicationThread()) {
r.run();
} else {
Platform.runLater(r);
}
} }
public static void showError(Scene parent, String header, String text, Throwable t) { public static void showError(Scene parent, String header, String text, Throwable t) {
if (Objects.isNull(t)) {
Dialogs.showError(parent, header, text);
return;
}
Runnable r = () -> { Runnable r = () -> {
AutosizeAlert alert = new AutosizeAlert(Alert.AlertType.ERROR, parent); Alert alert = new AutosizeAlert(Alert.AlertType.ERROR, parent);
alert.setTitle("Error"); alert.setTitle("Error");
alert.setHeaderText(header); alert.setHeaderText(header);
String content = text + "\n" + t.getLocalizedMessage(); String content = text;
if (t != null) {
content += " " + t.getLocalizedMessage();
}
alert.setContentText(content); alert.setContentText(content);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
String exceptionText = sw.toString();
Label label = new Label("The exception stacktrace was:");
TextArea textArea = new TextArea(exceptionText);
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setMaxWidth(Double.MAX_VALUE);
textArea.setMaxHeight(Double.MAX_VALUE);
GridPane.setVgrow(textArea, Priority.ALWAYS);
GridPane.setHgrow(textArea, Priority.ALWAYS);
GridPane expContent = new GridPane();
expContent.setMaxWidth(Double.MAX_VALUE);
expContent.add(label, 0, 0);
expContent.add(textArea, 0, 1);
alert.getDialogPane().setExpandableContent(expContent);
alert.getDialogPane().setMinHeight(Double.NEGATIVE_INFINITY);
alert.getDialogPane().setMinWidth(Double.NEGATIVE_INFINITY);
if (parent != null) { if (parent != null) {
Stage stage = (Stage)alert.getDialogPane().getScene().getWindow(); var stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getScene().getStylesheets().addAll((Collection<String>)parent.getStylesheets()); stage.getScene().getStylesheets().addAll(parent.getStylesheets());
} }
alert.showAndWait(); alert.showAndWait();
}; };
if (Platform.isFxApplicationThread()) { if (Platform.isFxApplicationThread()) {
r.run(); r.run();
} else { } else {
@ -170,24 +121,6 @@ public class Dialogs {
return confirm.getResult() == YES; return confirm.getResult() == YES;
} }
public static boolean showExpandedConfirmDialog(String title, String message, String expandedText, String header, Scene parent) {
AutosizeAlert confirm = new AutosizeAlert(Alert.AlertType.CONFIRMATION, message, parent, ButtonType.YES, ButtonType.NO);
confirm.setTitle(title);
confirm.setHeaderText(header);
TextArea textArea = new TextArea(expandedText);
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setMaxWidth(Double.MAX_VALUE);
textArea.setMaxHeight(Double.MAX_VALUE);
GridPane.setVgrow(textArea, Priority.ALWAYS);
GridPane.setHgrow(textArea, Priority.ALWAYS);
confirm.getDialogPane().setExpandableContent(textArea);
confirm.getDialogPane().setExpanded(true);
confirm.getDialogPane().setMinHeight(Double.NEGATIVE_INFINITY);
confirm.showAndWait();
return confirm.getResult() == ButtonType.YES;
}
public static ButtonType showShutdownDialog(Scene parent) { public static ButtonType showShutdownDialog(Scene parent) {
var message = "There are recordings in progress"; var message = "There are recordings in progress";
var confirm = new AutosizeAlert(AlertType.CONFIRMATION, "", parent, YES, FINISH, NO); var confirm = new AutosizeAlert(AlertType.CONFIRMATION, "", parent, YES, FINISH, NO);

View File

@ -52,12 +52,8 @@ public class HelpTab extends Tab {
Button openCfg = new Button("Open Config Dir"); Button openCfg = new Button("Open Config Dir");
openCfg.setStyle("-fx-font-family: 'Arial'; -fx-font-size: 16px; -fx-font-weight: bold; -fx-text-fill: #ffffff; -fx-background-color: #FF9800; -fx-padding: 15 30; -fx-border-radius: 5; -fx-background-radius: 5;"); openCfg.setStyle("-fx-font-family: 'Arial'; -fx-font-size: 16px; -fx-font-weight: bold; -fx-text-fill: #ffffff; -fx-background-color: #FF9800; -fx-padding: 15 30; -fx-border-radius: 5; -fx-background-radius: 5;");
Button openDiscord = new Button("Discord");
openDiscord.setStyle("-fx-font-family: 'Arial'; -fx-font-size: 16px; -fx-font-weight: bold; -fx-text-fill: #ffffff; -fx-background-color: #ff0022; -fx-padding: 15 30; -fx-border-radius: 5; -fx-background-radius: 5;");
File cfgDir = Config.getInstance().getConfigDir(); File cfgDir = Config.getInstance().getConfigDir();
String path = (cfgDir != null) ? cfgDir.getAbsolutePath() : "Unknown"; String path = (cfgDir != null) ? cfgDir.getAbsolutePath() : "Unknown";
Label configStaticLabel = new Label("Config Dir:"); Label configStaticLabel = new Label("Config Dir:");
configStaticLabel.setStyle("-fx-font-family: 'Arial'; -fx-font-size: 14px; -fx-font-weight: bold; -fx-alignment: center;"); configStaticLabel.setStyle("-fx-font-family: 'Arial'; -fx-font-size: 14px; -fx-font-weight: bold; -fx-alignment: center;");
Label configValueLabel = new Label(path); Label configValueLabel = new Label(path);
@ -78,7 +74,7 @@ public class HelpTab extends Tab {
VBox vbox = new VBox(); VBox vbox = new VBox();
vbox.setAlignment(Pos.CENTER); vbox.setAlignment(Pos.CENTER);
vbox.setSpacing(20); vbox.setSpacing(20);
vbox.getChildren().addAll(wanLabelBox, openHelp, configLabelBox, openCfg, logLabelBox, openLog, openDiscord); vbox.getChildren().addAll(wanLabelBox, openHelp, configLabelBox, openCfg, logLabelBox, openLog);
// Set up the BorderPane layout // Set up the BorderPane layout
BorderPane layout = new BorderPane(); BorderPane layout = new BorderPane();
@ -138,8 +134,6 @@ public class HelpTab extends Tab {
log.warn("Config dir doesn't exist: {}", configDir.getAbsolutePath()); log.warn("Config dir doesn't exist: {}", configDir.getAbsolutePath());
} }
}); });
openDiscord.setOnAction(e -> DesktopIntegration.open("https://discord.gg/8jCXgVHzgf"));
} }
private void startDocumentationServer() { private void startDocumentationServer() {

View File

@ -8,7 +8,7 @@
<parent> <parent>
<groupId>ctbrec</groupId> <groupId>ctbrec</groupId>
<artifactId>master</artifactId> <artifactId>master</artifactId>
<version>25.9.13</version> <version>25.9.10</version>
<relativePath>../master</relativePath> <relativePath>../master</relativePath>
</parent> </parent>

View File

@ -11,7 +11,7 @@
<groupId>ctbrec</groupId> <groupId>ctbrec</groupId>
<artifactId>master</artifactId> <artifactId>master</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>25.9.13</version> <version>25.9.10</version>
<modules> <modules>
<module>../common</module> <module>../common</module>

View File

@ -8,7 +8,7 @@
<parent> <parent>
<groupId>ctbrec</groupId> <groupId>ctbrec</groupId>
<artifactId>master</artifactId> <artifactId>master</artifactId>
<version>25.9.13</version> <version>25.9.10</version>
<relativePath>../master</relativePath> <relativePath>../master</relativePath>
</parent> </parent>