Add superchatlive alternative for stripchat
This commit is contained in:
parent
4b7f1f8057
commit
162fdef735
|
@ -44,19 +44,43 @@ public class StripchatConfigUI extends AbstractConfigUI {
|
|||
layout.add(l, 0, row);
|
||||
var toggleGroup = new ToggleGroup();
|
||||
var optionA = new RadioButton("Stripchat");
|
||||
optionA.setSelected(!Config.getInstance().getSettings().stripchatUseXhamster);
|
||||
optionA.setToggleGroup(toggleGroup);
|
||||
var optionB = new RadioButton("xHamsterLive");
|
||||
optionB.setSelected(!optionA.isSelected());
|
||||
var optionC = new RadioButton("SuperchatLive");
|
||||
// Set initial selections based on current configuration
|
||||
if (Config.getInstance().getSettings().stripchatUseXhamster && !Config.getInstance().getSettings().stripchatUseSuperchat) {
|
||||
optionB.setSelected(true);
|
||||
} else if (!Config.getInstance().getSettings().stripchatUseXhamster && Config.getInstance().getSettings().stripchatUseSuperchat) {
|
||||
optionC.setSelected(true);
|
||||
} else {
|
||||
optionA.setSelected(true);
|
||||
}
|
||||
optionA.setToggleGroup(toggleGroup);
|
||||
optionB.setToggleGroup(toggleGroup);
|
||||
optionC.setToggleGroup(toggleGroup);
|
||||
// Add listeners to update configuration settings
|
||||
optionA.selectedProperty().addListener((obs, oldV, newV) -> {
|
||||
Config.getInstance().getSettings().stripchatUseXhamster = !newV;
|
||||
Config.getInstance().getSettings().stripchatUseXhamster = false;
|
||||
Config.getInstance().getSettings().stripchatUseSuperchat = false;
|
||||
save();
|
||||
});
|
||||
|
||||
optionB.selectedProperty().addListener((obs, oldV, newV) -> {
|
||||
Config.getInstance().getSettings().stripchatUseXhamster = true;
|
||||
Config.getInstance().getSettings().stripchatUseSuperchat = false;
|
||||
save();
|
||||
});
|
||||
|
||||
optionC.selectedProperty().addListener((obs, oldV, newV) -> {
|
||||
Config.getInstance().getSettings().stripchatUseXhamster = false;
|
||||
Config.getInstance().getSettings().stripchatUseSuperchat = true;
|
||||
save();
|
||||
});
|
||||
|
||||
var hbox = new HBox();
|
||||
hbox.getChildren().addAll(optionA, optionB);
|
||||
hbox.getChildren().addAll(optionA, optionB, optionC);
|
||||
HBox.setMargin(optionA, new Insets(5));
|
||||
HBox.setMargin(optionB, new Insets(5));
|
||||
HBox.setMargin(optionC, new Insets(5));
|
||||
GridPane.setMargin(hbox, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
layout.add(hbox, 1, row++);
|
||||
|
||||
|
|
|
@ -194,6 +194,7 @@ public class Settings {
|
|||
public String stripchatUsername = "";
|
||||
public String stripchatPassword = "";
|
||||
public boolean stripchatUseXhamster = false;
|
||||
public boolean stripchatUseSuperchat = false;
|
||||
public List<String> tabOrder = new ArrayList<>();
|
||||
public boolean tabsSortable = true;
|
||||
public LocalTime timeoutRecordingStartingAt = LocalTime.of(0, 0);
|
||||
|
|
|
@ -37,9 +37,13 @@ public class Stripchat extends AbstractSite {
|
|||
@Override
|
||||
public void init() throws IOException {
|
||||
boolean hamster = getConfig().getSettings().stripchatUseXhamster;
|
||||
boolean superchat = getConfig().getSettings().stripchatUseSuperchat;
|
||||
if (hamster) {
|
||||
Stripchat.setDomain("xhamsterlive.com");
|
||||
Stripchat.setBaseUri("https://" + domain);
|
||||
} else if (superchat) {
|
||||
Stripchat.setDomain("superchatlive.com");
|
||||
Stripchat.setBaseUri("https://" + domain);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,7 +185,7 @@ public class Stripchat extends AbstractSite {
|
|||
|
||||
@Override
|
||||
public Model createModelFromUrl(String url) {
|
||||
Matcher m = Pattern.compile("https?://(?:.*?\\.)?(?:stripchat.com|xhamsterlive.com)/([^/]*?)/?").matcher(url);
|
||||
Matcher m = Pattern.compile("https?://(?:.*?\\.)?(?:stripchat.com|xhamsterlive.com|superchatlive.com)/([^/]*?)/?").matcher(url);
|
||||
if (m.matches()) {
|
||||
String modelName = m.group(1);
|
||||
return createModel(modelName);
|
||||
|
|
Loading…
Reference in New Issue