essential-actions
Clone or download
Modified Files
.idea/
.idea/
target/
target/
.classpath
.classpath
.factorypath
.factorypath
.project
.project
.settings/
.settings/
obssuite_motheraction.iml
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_11">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.stream-pi:util:1.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-controls:16-ea+7" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-controls:linux:16-ea+7" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:16-ea+7" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:linux:16-ea+7" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-base:16-ea+7" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-base:linux:16-ea+7" level="project" />
<orderEntry type="library" name="Maven: org.kordamp.ikonli:ikonli-javafx:11.5.0" level="project" />
<orderEntry type="library" name="Maven: org.kordamp.ikonli:ikonli-core:11.5.0" level="project" />
<orderEntry type="library" name="Maven: org.kordamp.ikonli:ikonli-fontawesome5-pack:11.5.0" level="project" />
<orderEntry type="library" name="Maven: com.stream-pi:action-api:1.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: net.twasi:obs-websocket-java:1.2.0" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.slf4j:slf4j-simple:1.7.30" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-client:9.4.35.v20201120" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-client:9.4.35.v20201120" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-http:9.4.35.v20201120" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-util:9.4.35.v20201120" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-io:9.4.35.v20201120" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-common:9.4.35.v20201120" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-api:9.4.35.v20201120" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.6" level="project" />
</component>
</module>
package mother;
package mother;
import mother.motherconnection.MotherConnection;
import mother.motherconnection.MotherConnection;
import javafx.application.Platform;
import javafx.application.Platform;
import javafx.concurrent.Task;
import javafx.concurrent.Task;
import javafx.scene.control.Button;
import javafx.scene.control.Button;
import net.twasi.obsremotejava.OBSRemoteController;
import net.twasi.obsremotejava.OBSRemoteController;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.alert.StreamPiAlertType;
public class OBSActionConnectionTask extends Task<Void>
public class OBSActionConnectionTask extends Task<Void>
{
{
private Runnable onFailToConnectRunnable = null;
private Runnable onFailToConnectRunnable = null;
private Runnable onConnectRunnable = null;
private Runnable onConnectRunnable = null;
private Runnable onDisconnectRunnable = null;
private Runnable onDisconnectRunnable = null;
public OBSActionConnectionTask(boolean runAsync, Runnable onFailToConnectRunnable,
public OBSActionConnectionTask(boolean runAsync, Runnable onFailToConnectRunnable,
Runnable onConnectRunnable, Runnable onDisconnectRunnable)
Runnable onConnectRunnable, Runnable onDisconnectRunnable)
{
{
this.onFailToConnectRunnable = onFailToConnectRunnable;
this.onFailToConnectRunnable = onFailToConnectRunnable;
this.onConnectRunnable = onConnectRunnable;
this.onConnectRunnable = onConnectRunnable;
this.onDisconnectRunnable = onDisconnectRunnable;
this.onDisconnectRunnable = onDisconnectRunnable;
if(runAsync)
if(runAsync)
{
{
new Thread(this).start();
new Thread(this).start();
}
}
else
else
{
{
call();
call();
}
}
}
}
@Override
@Override
protected Void call()
protected Void call()
{
{
try
try
{
{
String url = MotherConnection.getUrl();
String url = MotherConnection.getUrl();
String pass = MotherConnection.getPass();
String pass = MotherConnection.getPass();
setConnectDisconnectButtonDisable(true);
setConnectDisconnectButtonDisable(true);
if(!url.startsWith("ws://"))
if(!url.startsWith("ws://"))
{
{
new StreamPiAlert("Invalid URL","Please fix URL and try again", StreamPiAlertType.ERROR).show();
new StreamPiAlert("Invalid URL","Please fix URL and try again", StreamPiAlertType.ERROR).show();
return null;
return null;
}
}
if(pass.isEmpty() || pass.isBlank())
if(pass.isEmpty() || pass.isBlank())
pass = null;
pass = null;
OBSRemoteController obsRemoteController = new OBSRemoteController(url, false, pass);
OBSRemoteController obsRemoteController = new OBSRemoteController(url, false, pass);
if(obsRemoteController.isFailed())
if(obsRemoteController.isFailed())
{
{
new StreamPiAlert("Unable to Connect to OBS", "Is it even running? Make sure the websocket plugin is installed. Check Credentials too", StreamPiAlertType.ERROR).show();
new StreamPiAlert("Unable to Connect to OBS", "Is it even running? Make sure the websocket plugin is installed. Check Credentials too", StreamPiAlertType.ERROR).show();
}
}
obsRemoteController.registerConnectionFailedCallback(message->{
obsRemoteController.registerConnectionFailedCallback(message->{
setConnectDisconnectButtonText("Connect");
setConnectDisconnectButtonText("Connect");
new StreamPiAlert("Unable to Connect", "Unable to establish connection to WebSocket with provided crendentials\n\n"+
new StreamPiAlert("Unable to Connect", "Unable to establish connection to WebSocket with provided crendentials\n\n"+
"Detailed Error : "+message, StreamPiAlertType.ERROR).show();
"Detailed Error : "+message, StreamPiAlertType.ERROR).show();
MotherConnection.setRemoteController(null);
MotherConnection.setRemoteController(null);
if(onFailToConnectRunnable != null)
if(onFailToConnectRunnable != null)
{
{
onFailToConnectRunnable.run();
onFailToConnectRunnable.run();
onFailToConnectRunnable = null;
onFailToConnectRunnable = null;
}
}
});
});
obsRemoteController.registerDisconnectCallback(()->{
obsRemoteController.registerDisconnectCallback(()->{
setConnectDisconnectButtonText("Connect");
setConnectDisconnectButtonText("Connect");
MotherConnection.setRemoteController(null);
MotherConnection.setRemoteController(null);
if(onDisconnectRunnable != null)
if(onDisconnectRunnable != null)
{
{
onDisconnectRunnable.run();
onDisconnectRunnable.run();
onDisconnectRunnable = null;
onDisconnectRunnable = null;
}
}
});
});
obsRemoteController.registerConnectCallback(onConnect->{
obsRemoteController.registerConnectCallback(onConnect->{
setConnectDisconnectButtonText("Disconnect");
setConnectDisconnectButtonText("Disconnect");
MotherConnection.setRemoteController(obsRemoteController);
MotherConnection.setRemoteController(obsRemoteController);
if(onConnectRunnable != null)
if(onConnectRunnable != null)
{
{
onConnectRunnable.run();
onConnectRunnable.run();
onConnectRunnable = null;
onConnectRunnable = null;
}
}
});
});
}
}
catch (Exception e)
catch (Exception e)
{
{
new StreamPiAlert("Unable to Connect", "Unable to establish connection to WebSocket with provided crendentials", StreamPiAlertType.ERROR).show();
MotherConnection.showOBSNotRunningError();
MotherConnection.setRemoteController(null);
MotherConnection.setRemoteController(null);
e.printStackTrace();
e.printStackTrace();
}
}
finally
finally
{
{
setConnectDisconnectButtonDisable(false);
setConnectDisconnectButtonDisable(false);
}
}
return null;
return null;
}
}
private void setConnectDisconnectButtonText(String text)
private void setConnectDisconnectButtonText(String text)
{
{
if(MotherConnection.getConnectDisconnectButton() == null)
if(MotherConnection.getConnectDisconnectButton() == null)
return;
return;
Platform.runLater(()-> MotherConnection.getConnectDisconnectButton().setText(text));
Platform.runLater(()-> MotherConnection.getConnectDisconnectButton().setText(text));
}
}
private void setConnectDisconnectButtonDisable(boolean disable)
private void setConnectDisconnectButtonDisable(boolean disable)
{
{
if(MotherConnection.getConnectDisconnectButton() == null)
if(MotherConnection.getConnectDisconnectButton() == null)
return;
return;
Platform.runLater(()-> MotherConnection.getConnectDisconnectButton().setDisable(disable));
Platform.runLater(()-> MotherConnection.getConnectDisconnectButton().setDisable(disable));
}
}
}
}
package mother.motherconnection;
package mother.motherconnection;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.version.Version;
import com.stream_pi.util.version.Version;
import javafx.scene.control.Button;
import javafx.scene.control.Button;
import mother.OBSActionConnectionTask;
import mother.OBSActionConnectionTask;
import net.twasi.obsremotejava.OBSRemoteController;
import net.twasi.obsremotejava.OBSRemoteController;
import net.twasi.obsremotejava.callbacks.Callback;
import net.twasi.obsremotejava.callbacks.Callback;
import net.twasi.obsremotejava.requests.ResponseBase;
public class MotherConnection
public class MotherConnection
{
{
private static OBSRemoteController obsRemoteController = null;
private static OBSRemoteController obsRemoteController = null;
public static final Version VERSION = new Version(2,0,0);
public static final Version VERSION = new Version(2,0,0);
private static String url = null;
private static String url = null;
private static String pass = null;
private static String pass = null;
private static Button connectDisconnectButton = null;
private static Button connectDisconnectButton = null;
public static void setConnectDisconnectButton(Button connectDisconnectButton)
public static void setConnectDisconnectButton(Button connectDisconnectButton)
{
{
MotherConnection.connectDisconnectButton = connectDisconnectButton;
MotherConnection.connectDisconnectButton = connectDisconnectButton;
}
}
public static Button getConnectDisconnectButton()
public static Button getConnectDisconnectButton()
{
{
return connectDisconnectButton;
return connectDisconnectButton;
}
}
public static void setUrl(String url) {
public static void setUrl(String url) {
MotherConnection.url = url;
MotherConnection.url = url;
}
}
public static void setPass(String pass) {
public static void setPass(String pass) {
MotherConnection.pass = pass;
MotherConnection.pass = pass;
}
}
public static String getUrl() {
public static String getUrl() {
return url;
return url;
}
}
public static String getPass() {
public static String getPass() {
return pass;
return pass;
}
}
public static void connect()
public static void connect()
{
{
connect(true, null, null, null);
connect(true, null, null, null);
}
}
public static void connect(Runnable onConnectRunnable)
public static void connect(Runnable onConnectRunnable)
{
{
connect(true, null, onConnectRunnable, null);
connect(true, null, onConnectRunnable, null);
}
}
public static void connect(boolean runAsync, Runnable onFailToConnectRunnable,
public static void connect(boolean runAsync, Runnable onFailToConnectRunnable,
Runnable onConnectRunnable, Runnable onDisconnectRunnable)
Runnable onConnectRunnable, Runnable onDisconnectRunnable)
{
{
new OBSActionConnectionTask(runAsync, onFailToConnectRunnable,
new OBSActionConnectionTask(runAsync, onFailToConnectRunnable,
onConnectRunnable, onDisconnectRunnable);
onConnectRunnable, onDisconnectRunnable);
}
}
public static OBSRemoteController getRemoteController()
public static OBSRemoteController getRemoteController()
{
{
return obsRemoteController;
return obsRemoteController;
}
}
public static void setRemoteController(OBSRemoteController obsRemoteController)
public static void setRemoteController(OBSRemoteController obsRemoteController)
{
{
MotherConnection.obsRemoteController = obsRemoteController;
MotherConnection.obsRemoteController = obsRemoteController;
}
}
public static Callback getDefaultCallBack(String head, String content)
public static Callback getDefaultCallBack(String head, String content)
{
{
return response ->
return response ->
{
{
if(response.getStatus().equals("error"))
if(response.getStatus().equals("error"))
{
{
new StreamPiAlert(head, content, StreamPiAlertType.ERROR).show();
new StreamPiAlert(head, content, StreamPiAlertType.ERROR).show();
}
}
};
};
}
}
public static void showOBSNotRunningError()
{
new StreamPiAlert("Is OBS Connected?",
"It seems there is no connection to OBS, please connect it in Settings", StreamPiAlertType.WARNING)
.show();
}
}
}
package setcurrentprofile;
package setcurrentprofile;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.exception.MinorException;
import mother.motherconnection.MotherConnection;
import mother.motherconnection.MotherConnection;
public class SetCurrentProfile extends NormalAction
public class SetCurrentProfile extends NormalAction
{
{
public SetCurrentProfile() {
public SetCurrentProfile() {
setName("Set Current Profile");
setName("Set Current Profile");
setCategory("OBS");
setCategory("OBS");
setVisibilityInServerSettingsPane(false);
setVisibilityInServerSettingsPane(false);
setAuthor("rnayabed");
setAuthor("rnayabed");
setVersion(MotherConnection.VERSION);
setVersion(MotherConnection.VERSION);
}
}
@Override
@Override
public void initProperties() throws Exception
public void initProperties() throws Exception
{
{
Property currentProfileProperty = new Property("profile", Type.STRING);
Property currentProfileProperty = new Property("profile", Type.STRING);
currentProfileProperty.setDisplayName("Profile Name");
currentProfileProperty.setDisplayName("Profile Name");
Property autoConnectProperty = new Property("auto_connect", Type.BOOLEAN);
Property autoConnectProperty = new Property("auto_connect", Type.BOOLEAN);
autoConnectProperty.setDefaultValueBoolean(true);
autoConnectProperty.setDefaultValueBoolean(true);
autoConnectProperty.setDisplayName("Auto Connect if not connected");
autoConnectProperty.setDisplayName("Auto Connect if not connected");
addClientProperties(currentProfileProperty, autoConnectProperty);
addClientProperties(currentProfileProperty, autoConnectProperty);
}
}
@Override
@Override
public void onActionClicked() throws Exception
public void onActionClicked() throws Exception
{
{
String profile = getClientProperties().getSingleProperty("profile").getStringValue();
String profile = getClientProperties().getSingleProperty("profile").getStringValue();
if(profile.isBlank())
if(profile.isBlank())
{
{
throw new MinorException("Blank Profile Name","No Profile Name specified");
throw new MinorException("Blank Profile Name","No Profile Name specified");
}
}
if (MotherConnection.getRemoteController() == null)
if (MotherConnection.getRemoteController() == null)
{
{
boolean autoConnect = getClientProperties().getSingleProperty(
boolean autoConnect = getClientProperties().getSingleProperty(
"auto_connect"
"auto_connect"
).getBoolValue();
).getBoolValue();
if(autoConnect)
if(autoConnect)
{
{
MotherConnection.connect(()->setProfile(profile));
MotherConnection.connect(()->setProfile(profile));
}
}
else
else
{
{
new StreamPiAlert("Is OBS Connected?",
MotherConnection.showOBSNotRunningError();
"It seems there is no connection to OBS, please connect it in Settings", StreamPiAlertType.WARNING)
.show();
}
}
}
}
else
else
{
{
setProfile(profile);
setProfile(profile);
}
}
}
}
public void setProfile(String profile)
public void setProfile(String profile)
{
{
MotherConnection.getRemoteController().setCurrentProfile(profile, setCurrentProfileResponse -> {
MotherConnection.getRemoteController().setCurrentProfile(profile, setCurrentProfileResponse -> {
String status = setCurrentProfileResponse.getStatus();
String status = setCurrentProfileResponse.getStatus();
String error = setCurrentProfileResponse.getError();
String error = setCurrentProfileResponse.getError();
if(status.equals("error"))
if(status.equals("error"))
{
{
String content;
String content;
if(error.equals("profile does not exist"))
if(error.equals("profile does not exist"))
{
{
content = "Profile "+profile+" does not exist.";
content = "Profile "+profile+" does not exist.";
}
}
else
else
{
{
content = error;
content = error;
}
}
new StreamPiAlert("OBS",content, StreamPiAlertType.ERROR).show();
new StreamPiAlert("OBS",content, StreamPiAlertType.ERROR).show();
}
}
});
});
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>obssuite_setcurrentsceneaction</artifactId>
<artifactId>obssuite_setcurrentsceneaction</artifactId>
<version>1.0.0</version>
<version>2.0.0</version>
<build>
<build>
<plugins>
<plugins>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<version>3.1.0</version>
<executions>
<executions>
<execution>
<execution>
<id>test-jar</id>
<id>test-jar</id>
<phase>package</phase>
<phase>package</phase>
<goals>
<goals>
<goal>test-jar</goal>
<goal>test-jar</goal>
</goals>
</goals>
</execution>
</execution>
</executions>
</executions>
</plugin>
</plugin>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.8.1</version>
<configuration>
<configuration>
<release>11</release>
<release>11</release>
</configuration>
</configuration>
</plugin>
</plugin>
</plugins>
</plugins>
</build>
</build>
<properties>
<properties>
<ActionAPIVersion>1.0.0-SNAPSHOT</ActionAPIVersion>
<ActionAPIVersion>1.0.0-SNAPSHOT</ActionAPIVersion>
<UtilVersion>1.0.0-SNAPSHOT</UtilVersion>
<UtilVersion>1.0.0-SNAPSHOT</UtilVersion>
<OBSSuiteMotherVersion>1.1.0</OBSSuiteMotherVersion>
<OBSSuiteMotherVersion>2.0.0</OBSSuiteMotherVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.target>11</maven.compiler.target>
</properties>
</properties>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>util</artifactId>
<artifactId>util</artifactId>
<version>${UtilVersion}</version>
<version>${UtilVersion}</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>action-api</artifactId>
<artifactId>action-api</artifactId>
<version>${ActionAPIVersion}</version>
<version>${ActionAPIVersion}</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>obssuite_motheraction</artifactId>
<artifactId>obssuite_motheraction</artifactId>
<version>${OBSSuiteMotherVersion}</version>
<version>${OBSSuiteMotherVersion}</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
package setcurrentscene;
package setcurrentscene;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.version.Version;
import com.stream_pi.util.exception.MinorException;
import mother.motherconnection.MotherConnection;
import mother.motherconnection.MotherConnection;
import net.twasi.obsremotejava.OBSRemoteController;
public class SetCurrentScene extends NormalAction {
public class SetCurrentScene extends NormalAction
{
public SetCurrentScene() {
public SetCurrentScene()
{
setName("Set Current Scene");
setName("Set Current Scene");
setCategory("OBS");
setCategory("OBS");
setVisibilityInServerSettingsPane(false);
setVisibilityInServerSettingsPane(false);
setAuthor("rnayabed");
setAuthor("rnayabed");
setVersion(new Version(1, 0, 0));
setVersion(MotherConnection.VERSION);
}
}
@Override
@Override
public void initProperties() throws Exception {
public void initProperties() throws Exception
// TODO Auto-generated method stub
{
Property currentSceneProperty = new Property("scene", Type.STRING);
Property currentSceneProperty = new Property("current_scene", Type.STRING);
currentSceneProperty.setDisplayName("Scene Name");
currentSceneProperty.setDisplayName("Scene Name");
addClientProperties(currentSceneProperty);
}
@Override
Property autoConnectProperty = new Property("auto_connect", Type.BOOLEAN);
public void initAction() throws Exception {
autoConnectProperty.setDefaultValueBoolean(true);
// TODO Auto-generated method stub
autoConnectProperty.setDisplayName("Auto Connect if not connected");
addClientProperties(currentSceneProperty, autoConnectProperty);
}
}
@Override
@Override
public void onActionClicked() throws Exception {
public void onActionClicked() throws Exception
// TODO Auto-generated method stub
{
String scene = getClientProperties().getSingleProperty("scene").getStringValue();
OBSRemoteController controller = MotherConnection.getRemoteController();
if(scene.isBlank())
if (controller == null) {
{
new StreamPiAlert("Is OBS Connected?",
throw new MinorException("Blank Scene Name","No Scene Name specified");
"It seems there is no connection to OBS, please connect it in Settings", StreamPiAlertType.WARNING)
}
.show();
} else {
if (MotherConnection.getRemoteController() == null)
controller.setCurrentScene(getClientProperties().getSingleProperty("current_scene").getStringValue(), MotherConnection.getDefaultCallBack(
{
"Unable to Set Current Scene","Failed to set current Scene"
boolean autoConnect = getClientProperties().getSingleProperty(
));
"auto_connect"
).getBoolValue();
if(autoConnect)
{
MotherConnection.connect(()->setScene(scene));
}
else
{
MotherConnection.showOBSNotRunningError();
}
}
else
{
setScene(scene);
}
}
}
}
@Override
public void setScene(String scene)
public void onShutDown() throws Exception {
{
// TODO Auto-generated method stub
MotherConnection.getRemoteController().setCurrentScene(scene, setCurrentSceneResponse -> {
String status = setCurrentSceneResponse.getStatus();
String error = setCurrentSceneResponse.getError();
if(status.equals("error"))
{
String content;
if(error.equals("scene does not exist"))
{
content = "Scene "+scene+" does not exist.";
}
else
{
content = error;
}
new StreamPiAlert("OBS",content, StreamPiAlertType.ERROR).show();
}
});
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>obssuite_setcurrenttransitionaction</artifactId>
<artifactId>obssuite_setcurrenttransitionaction</artifactId>
<version>1.0.0</version>
<version>2.0.0</version>
<build>
<build>
<plugins>
<plugins>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<version>3.1.0</version>
<executions>
<executions>
<execution>
<execution>
<id>test-jar</id>
<id>test-jar</id>
<phase>package</phase>
<phase>package</phase>
<goals>
<goals>
<goal>test-jar</goal>
<goal>test-jar</goal>
</goals>
</goals>
</execution>
</execution>
</executions>
</executions>
</plugin>
</plugin>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.8.1</version>
<configuration>
<configuration>
<release>11</release>
<release>11</release>
</configuration>
</configuration>
</plugin>
</plugin>
</plugins>
</plugins>
</build>
</build>
<properties>
<properties>
<ActionAPIVersion>1.0.0-SNAPSHOT</ActionAPIVersion>
<ActionAPIVersion>1.0.0-SNAPSHOT</ActionAPIVersion>
<UtilVersion>1.0.0-SNAPSHOT</UtilVersion>
<UtilVersion>1.0.0-SNAPSHOT</UtilVersion>
<OBSSuiteMotherVersion>1.1.0</OBSSuiteMotherVersion>
<OBSSuiteMotherVersion>2.0.0</OBSSuiteMotherVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.target>11</maven.compiler.target>
</properties>
</properties>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>util</artifactId>
<artifactId>util</artifactId>
<version>${UtilVersion}</version>
<version>${UtilVersion}</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>action-api</artifactId>
<artifactId>action-api</artifactId>
<version>${ActionAPIVersion}</version>
<version>${ActionAPIVersion}</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>obssuite_motheraction</artifactId>
<artifactId>obssuite_motheraction</artifactId>
<version>${OBSSuiteMotherVersion}</version>
<version>${OBSSuiteMotherVersion}</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
M
obssuite/setcurrenttransition/src/main/java/setcurrenttransition/SetCurrentTransition.java
+62
−27
package setcurrenttransition;
package setcurrenttransition;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import com.stream_pi.util.version.Version;
import mother.motherconnection.MotherConnection;
import mother.motherconnection.MotherConnection;
import net.twasi.obsremotejava.OBSRemoteController;
import net.twasi.obsremotejava.OBSRemoteController;
public class SetCurrentTransition extends NormalAction {
public class SetCurrentTransition extends NormalAction {
public SetCurrentTransition() {
public SetCurrentTransition()
{
setName("Set Current Transition");
setName("Set Current Transition");
setCategory("OBS");
setCategory("OBS");
setVisibilityInServerSettingsPane(false);
setVisibilityInServerSettingsPane(false);
setAuthor("rnayabed");
setAuthor("rnayabed");
setVersion(new Version(1, 0, 0));
setVersion(MotherConnection.VERSION);
}
}
@Override
@Override
public void initProperties() throws Exception {
public void initProperties() throws Exception
Property currentTransitionProperty = new Property("current_transition", Type.STRING);
{
Property currentTransitionProperty = new Property("transition", Type.STRING);
currentTransitionProperty.setDisplayName("Transition Name");
currentTransitionProperty.setDisplayName("Transition Name");
addClientProperties(currentTransitionProperty);
}
@Override
Property autoConnectProperty = new Property("auto_connect", Type.BOOLEAN);
public void initAction() throws Exception {
autoConnectProperty.setDefaultValueBoolean(true);
// TODO Auto-generated method stub
autoConnectProperty.setDisplayName("Auto Connect if not connected");
addClientProperties(currentTransitionProperty, autoConnectProperty);
}
}
@Override
@Override
public void onActionClicked() throws Exception {
public void onActionClicked() throws Exception
// TODO Auto-generated method stub
{
String transition = getClientProperties().getSingleProperty("transition").getStringValue();
OBSRemoteController controller = MotherConnection.getRemoteController();
if(transition.isBlank())
if (controller == null) {
{
new StreamPiAlert("Is OBS Connected?",
throw new MinorException("Blank Transition Name","No Transition Name specified");
"It seems there is no connection to OBS, please connect it in Settings", StreamPiAlertType.WARNING)
}
.show();
} else {
if (MotherConnection.getRemoteController() == null)
controller.setCurrentTransition(getClientProperties().getSingleProperty("current_transition").getStringValue(), MotherConnection.getDefaultCallBack(
{
"Unable to Set Current Transition","Failed to set current Transition"
boolean autoConnect = getClientProperties().getSingleProperty(
));
"auto_connect"
).getBoolValue();
if(autoConnect)
{
MotherConnection.connect(()->setTransition(transition));
}
else
{
MotherConnection.showOBSNotRunningError();
}
}
else
{
setTransition(transition);
}
}
}
}
@Override
public void onShutDown() throws Exception {
// TODO Auto-generated method stub
public void setTransition(String transition)
{
MotherConnection.getRemoteController().setCurrentTransition(transition, setCurrentTransitionResponse -> {
String status = setCurrentTransitionResponse.getStatus();
String error = setCurrentTransitionResponse.getError();
if(status.equals("error"))
{
String content;
if(error.equals("transition does not exist"))
{
content = "Transition "+transition+" does not exist.";
}
else
{
content = error;
}
new StreamPiAlert("OBS",content, StreamPiAlertType.ERROR).show();
}
});
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>obssuite_setmuteaction</artifactId>
<artifactId>obssuite_setmuteaction</artifactId>
<version>1.0.0</version>
<version>2.0.0</version>
<build>
<build>
<plugins>
<plugins>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<version>3.1.0</version>
<executions>
<executions>
<execution>
<execution>
<id>test-jar</id>
<id>test-jar</id>
<phase>package</phase>
<phase>package</phase>
<goals>
<goals>
<goal>test-jar</goal>
<goal>test-jar</goal>
</goals>
</goals>
</execution>
</execution>
</executions>
</executions>
</plugin>
</plugin>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.8.1</version>
<configuration>
<configuration>
<release>11</release>
<release>11</release>
</configuration>
</configuration>
</plugin>
</plugin>
</plugins>
</plugins>
</build>
</build>
<properties>
<properties>
<ActionAPIVersion>1.0.0-SNAPSHOT</ActionAPIVersion>
<ActionAPIVersion>1.0.0-SNAPSHOT</ActionAPIVersion>
<UtilVersion>1.0.0-SNAPSHOT</UtilVersion>
<UtilVersion>1.0.0-SNAPSHOT</UtilVersion>
<OBSSuiteMotherVersion>1.1.0</OBSSuiteMotherVersion>
<OBSSuiteMotherVersion>2.0.0</OBSSuiteMotherVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.target>11</maven.compiler.target>
</properties>
</properties>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>util</artifactId>
<artifactId>util</artifactId>
<version>${UtilVersion}</version>
<version>${UtilVersion}</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>action-api</artifactId>
<artifactId>action-api</artifactId>
<version>${ActionAPIVersion}</version>
<version>${ActionAPIVersion}</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>obssuite_motheraction</artifactId>
<artifactId>obssuite_motheraction</artifactId>
<version>${OBSSuiteMotherVersion}</version>
<version>${OBSSuiteMotherVersion}</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
package setmute;
package setmute;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.action_api.externalplugin.ToggleAction;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import com.stream_pi.util.version.Version;
import mother.motherconnection.MotherConnection;
import mother.motherconnection.MotherConnection;
import net.twasi.obsremotejava.OBSRemoteController;
import net.twasi.obsremotejava.OBSRemoteController;
public class SetMute extends NormalAction {
public class SetMute extends ToggleAction
{
public SetMute() {
public SetMute()
{
setName("Set Mute");
setName("Set Mute");
setCategory("OBS");
setCategory("OBS");
setVisibilityInServerSettingsPane(false);
setVisibilityInServerSettingsPane(false);
setAuthor("rnayabed");
setAuthor("rnayabed");
setVersion(new Version(1, 0, 0));
setVersion(MotherConnection.VERSION);
}
}
@Override
@Override
public void initProperties() throws Exception {
public void onToggleOn() throws Exception
Property sourceProperty = new Property("source", Type.STRING);
{
sourceProperty.setDisplayName("Source");
onClicked(true);
Property isMuteProperty = new Property("mute", Type.BOOLEAN);
isMuteProperty.setDisplayName("Mute");
addClientProperties(sourceProperty,isMuteProperty);
}
}
@Override
@Override
public void initAction() throws Exception {
public void onToggleOff() throws Exception
// TODO Auto-generated method stub
{
onClicked(false);
}
}
@Override
@Override
public void onActionClicked() throws Exception {
public void initProperties() throws Exception
// TODO Auto-generated method stub
{
Property sourceProperty = new Property("source", Type.STRING);
OBSRemoteController controller = MotherConnection.getRemoteController();
sourceProperty.setDisplayName("Source");
if (controller == null) {
Property autoConnectProperty = new Property("auto_connect", Type.BOOLEAN);
new StreamPiAlert("Is OBS Connected?",
autoConnectProperty.setDefaultValueBoolean(true);
"It seems there is no connection to OBS, please connect it in Settings", StreamPiAlertType.WARNING)
autoConnectProperty.setDisplayName("Auto Connect if not connected");
.show();
} else {
addClientProperties(sourceProperty, autoConnectProperty);
controller.setMute(getClientProperties().getSingleProperty("source").getStringValue(), getClientProperties().getSingleProperty("mute").getBoolValue(), MotherConnection.getDefaultCallBack(
}
"Failed to mute source","Failed to do that"
));
public void onClicked(boolean mute) throws MinorException
{
String source = getClientProperties().getSingleProperty("source").getStringValue();
if(source.isBlank())
{
throw new MinorException("Blank Source Name","No Source specified");
}
if (MotherConnection.getRemoteController() == null)
{
boolean autoConnect = getClientProperties().getSingleProperty(
"auto_connect"
).getBoolValue();
if(autoConnect)
{
MotherConnection.connect(()->setMute(source, mute));
}
else
{
MotherConnection.showOBSNotRunningError();
}
}
else
{
setMute(source, mute);
}
}
}
}
@Override
public void setMute(String scene, boolean mute)
public void onShutDown() throws Exception {
{
// TODO Auto-generated method stub
MotherConnection.getRemoteController().setMute(scene, mute, setMuteResponse -> {
String status = setMuteResponse.getStatus();
String error = setMuteResponse.getError();
if(status.equals("error"))
{
String content;
if(error.equals("source does not exist"))
{
content = "Source "+scene+" does not exist.";
}
else
{
content = error;
}
new StreamPiAlert("OBS",content, StreamPiAlertType.ERROR).show();
}
});
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>obssuite_setpreviewsceneaction</artifactId>
<artifactId>obssuite_setpreviewsceneaction</artifactId>
<version>1.0.0</version>
<version>2.0.0</version>
<build>
<build>
<plugins>
<plugins>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<version>3.1.0</version>
<executions>
<executions>
<execution>
<execution>
<id>test-jar</id>
<id>test-jar</id>
<phase>package</phase>
<phase>package</phase>
<goals>
<goals>
<goal>test-jar</goal>
<goal>test-jar</goal>
</goals>
</goals>
</execution>
</execution>
</executions>
</executions>
</plugin>
</plugin>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.8.1</version>
<configuration>
<configuration>
<release>11</release>
<release>11</release>
</configuration>
</configuration>
</plugin>
</plugin>
</plugins>
</plugins>
</build>
</build>
<properties>
<properties>
<ActionAPIVersion>1.0.0-SNAPSHOT</ActionAPIVersion>
<ActionAPIVersion>1.0.0-SNAPSHOT</ActionAPIVersion>
<UtilVersion>1.0.0-SNAPSHOT</UtilVersion>
<UtilVersion>1.0.0-SNAPSHOT</UtilVersion>
<OBSSuiteMotherVersion>1.1.0</OBSSuiteMotherVersion>
<OBSSuiteMotherVersion>2.0.0</OBSSuiteMotherVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.target>11</maven.compiler.target>
</properties>
</properties>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>util</artifactId>
<artifactId>util</artifactId>
<version>${UtilVersion}</version>
<version>${UtilVersion}</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>action-api</artifactId>
<artifactId>action-api</artifactId>
<version>${ActionAPIVersion}</version>
<version>${ActionAPIVersion}</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>obssuite_motheraction</artifactId>
<artifactId>obssuite_motheraction</artifactId>
<version>${OBSSuiteMotherVersion}</version>
<version>${OBSSuiteMotherVersion}</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
package setpreviewscene;
package setpreviewscene;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import com.stream_pi.util.version.Version;
import mother.motherconnection.MotherConnection;
import mother.motherconnection.MotherConnection;
import net.twasi.obsremotejava.OBSRemoteController;
import net.twasi.obsremotejava.OBSRemoteController;
public class SetPreviewScene extends NormalAction {
public class SetPreviewScene extends NormalAction
{
public SetPreviewScene() {
public SetPreviewScene()
{
setName("Set Preview Scene");
setName("Set Preview Scene");
setCategory("OBS");
setCategory("OBS");
setVisibilityInServerSettingsPane(false);
setVisibilityInServerSettingsPane(false);
setAuthor("rnayabed");
setAuthor("rnayabed");
setVersion(new Version(1, 0, 0));
setVersion(MotherConnection.VERSION);
}
}
@Override
@Override
public void initProperties() throws Exception {
public void initProperties() throws Exception {
Property previewSceneProperty = new Property("preview_scene", Type.STRING);
Property previewSceneProperty = new Property("preview_scene", Type.STRING);
previewSceneProperty.setDisplayName("Preview Scene");
previewSceneProperty.setDisplayName("Preview Scene");
addClientProperties(previewSceneProperty);
Property autoConnectProperty = new Property("auto_connect", Type.BOOLEAN);
}
autoConnectProperty.setDefaultValueBoolean(true);
autoConnectProperty.setDisplayName("Auto Connect if not connected");
@Override
addClientProperties(previewSceneProperty, autoConnectProperty);
public void initAction() throws Exception {
// TODO Auto-generated method stub
}
}
@Override
@Override
public void onActionClicked() throws Exception {
public void onActionClicked() throws Exception
// TODO Auto-generated method stub
{
String previewScene = getClientProperties().getSingleProperty("preview_scene").getStringValue();
OBSRemoteController controller = MotherConnection.getRemoteController();
if(previewScene.isBlank())
if (controller == null) {
{
new StreamPiAlert("Is OBS Connected?",
throw new MinorException("Blank Preview Scene Name","No Preview Scene Name specified");
"It seems there is no connection to OBS, please connect it in Settings", StreamPiAlertType.WARNING)
}
.show();
} else {
if (MotherConnection.getRemoteController() == null)
controller.setPreviewScene(getClientProperties().getSingleProperty("preview_scene").getStringValue(), MotherConnection.getDefaultCallBack(
{
"Failed to set preview scene","Failed to do that"
boolean autoConnect = getClientProperties().getSingleProperty(
));
"auto_connect"
).getBoolValue();
if(autoConnect)
{
MotherConnection.connect(()->setPreviewScene(previewScene));
}
else
{
MotherConnection.showOBSNotRunningError();
}
}
else
{
setPreviewScene(previewScene);
}
}
}
}
@Override
public void setPreviewScene(String previewScene)
public void onShutDown() throws Exception {
{
// TODO Auto-generated method stub
MotherConnection.getRemoteController().setPreviewScene(previewScene, setPreviewSceneResponse -> {
String status = setPreviewSceneResponse.getStatus();
String error = setPreviewSceneResponse.getError();
if(status.equals("error"))
{
String content;
if(error.equals("scene does not exist"))
{
content = "Preview Scene "+previewScene+" does not exist.";
}
else
{
content = error;
}
new StreamPiAlert("OBS",content, StreamPiAlertType.ERROR).show();
}
});
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>obssuite_setrecordingaction</artifactId>
<artifactId>obssuite_setrecordingaction</artifactId>
<version>1.0.0</version>
<version>2.0.0</version>
<build>
<build>
<plugins>
<plugins>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<version>3.1.0</version>
<executions>
<executions>
<execution>
<execution>
<id>test-jar</id>
<id>test-jar</id>
<phase>package</phase>
<phase>package</phase>
<goals>
<goals>
<goal>test-jar</goal>
<goal>test-jar</goal>
</goals>
</goals>
</execution>
</execution>
</executions>
</executions>
</plugin>
</plugin>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.8.1</version>
<configuration>
<configuration>
<release>11</release>
<release>11</release>
</configuration>
</configuration>
</plugin>
</plugin>
</plugins>
</plugins>
</build>
</build>
<properties>
<properties>
<ActionAPIVersion>1.0.0-SNAPSHOT</ActionAPIVersion>
<ActionAPIVersion>1.0.0-SNAPSHOT</ActionAPIVersion>
<UtilVersion>1.0.0-SNAPSHOT</UtilVersion>
<UtilVersion>1.0.0-SNAPSHOT</UtilVersion>
<OBSSuiteMotherVersion>1.1.0</OBSSuiteMotherVersion>
<OBSSuiteMotherVersion>2.0.0</OBSSuiteMotherVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.target>11</maven.compiler.target>
</properties>
</properties>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>util</artifactId>
<artifactId>util</artifactId>
<version>${UtilVersion}</version>
<version>${UtilVersion}</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>action-api</artifactId>
<artifactId>action-api</artifactId>
<version>${ActionAPIVersion}</version>
<version>${ActionAPIVersion}</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>obssuite_motheraction</artifactId>
<artifactId>obssuite_motheraction</artifactId>
<version>${OBSSuiteMotherVersion}</version>
<version>${OBSSuiteMotherVersion}</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
package setrecording;
package setrecording;
import java.util.ArrayList;
import java.util.ArrayList;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.action_api.externalplugin.ToggleAction;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import com.stream_pi.util.version.Version;
import mother.motherconnection.MotherConnection;
import mother.motherconnection.MotherConnection;
import net.twasi.obsremotejava.OBSRemoteController;
import net.twasi.obsremotejava.OBSRemoteController;
public class SetRecording extends NormalAction {
public class SetRecording extends ToggleAction
{
public SetRecording() {
public SetRecording() {
setName("Set Recording");
setName("Set Recording");
setCategory("OBS");
setCategory("OBS");
setVisibilityInServerSettingsPane(false);
setVisibilityInServerSettingsPane(false);
setAuthor("rnayabed");
setAuthor("rnayabed");
setVersion(new Version(1, 0, 0));
setVersion(MotherConnection.VERSION);
states = new ArrayList<>();
states.add("Start");
states.add("Stop");
}
}
private ArrayList<String> states;
@Override
@Override
public void initProperties() throws Exception {
public void onToggleOn() throws Exception
{
Property recordingStatusProperty = new Property("recording_status", Type.LIST);
onClicked(true);
recordingStatusProperty.setListValue(states);
recordingStatusProperty.setDisplayName("Recording State");
addClientProperties(recordingStatusProperty);
}
}
@Override
@Override
public void initAction() throws Exception {
public void onToggleOff() throws Exception
// TODO Auto-generated method stub
{
onClicked(false);
}
}
@Override
@Override
public void onActionClicked() throws Exception {
public void initProperties() throws Exception
// TODO Auto-generated method stub
{
Property autoConnectProperty = new Property("auto_connect", Type.BOOLEAN);
autoConnectProperty.setDefaultValueBoolean(true);
autoConnectProperty.setDisplayName("Auto Connect if not connected");
OBSRemoteController controller = MotherConnection.getRemoteController();
addClientProperties(autoConnectProperty);
}
if (controller == null) {
public void onClicked(boolean record) throws MinorException
new StreamPiAlert("Is OBS Connected?",
{
"It seems there is no connection to OBS, please connect it in Settings", StreamPiAlertType.WARNING)
if (MotherConnection.getRemoteController() == null)
.show();
{
} else {
boolean autoConnect = getClientProperties().getSingleProperty(
"auto_connect"
String state = states.get(getClientProperties().getSingleProperty("recording_status").getSelectedIndex());
).getBoolValue();
if(state.equals("Start"))
if(autoConnect)
{
{
controller.startRecording(MotherConnection.getDefaultCallBack("Failed to Start Recording","Failed to do that"));
MotherConnection.connect(()->setRecording(record));
}
}
else if(state.equals("Stop"))
else
{
{
controller.stopRecording(MotherConnection.getDefaultCallBack("Failed to Stop Recording","Failed to do that"));
MotherConnection.showOBSNotRunningError();
}
}
}
}
else
{
setRecording(record);
}
}
}
@Override
public void setRecording(boolean recording)
public void onShutDown() throws Exception {
{
// TODO Auto-generated method stub
if(recording)
{
MotherConnection.getRemoteController().startRecording(setRecordingResponse -> {
String status = setRecordingResponse.getStatus();
String error = setRecordingResponse.getError();
errorHandler(status, error);
});
}
else
{
MotherConnection.getRemoteController().stopRecording(setRecordingResponse -> {
String status = setRecordingResponse.getStatus();
String error = setRecordingResponse.getError();
errorHandler(status, error);
});
}
}
private void errorHandler(String status, String error)
{
if(status.equals("error"))
{
new StreamPiAlert("OBS",error, StreamPiAlertType.ERROR).show();
}
}
}
}
}