essential-actions
Clone or download
Modified Files
<?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_motheraction</artifactId>
<artifactId>obssuite_motheraction</artifactId>
<version>1.0.0</version>
<version>1.1.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>
<OBSWebsocketJavaVersion>1.2.0</OBSWebsocketJavaVersion>
<OBSWebsocketJavaVersion>1.2.0</OBSWebsocketJavaVersion>
<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>net.twasi</groupId>
<groupId>net.twasi</groupId>
<artifactId>obs-websocket-java</artifactId>
<artifactId>obs-websocket-java</artifactId>
<version>${OBSWebsocketJavaVersion}</version>
<version>${OBSWebsocketJavaVersion}</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-client</artifactId>
<artifactId>websocket-client</artifactId>
<version>9.4.39.v20210325</version>
<version>9.4.39.v20210325</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
<version>2.8.6</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
package mother;
package mother;
import com.stream_pi.action_api.actionproperty.property.ControlType;
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.version.Version;
import com.stream_pi.util.version.Version;
import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.exception.MinorException;
import mother.motherconnection.MotherConnection;
import mother.motherconnection.MotherConnection;
import javafx.scene.control.Button;
import javafx.scene.control.Button;
public class Mother extends NormalAction
public class Mother extends NormalAction
{
{
public Mother()
public Mother()
{
{
setName("OBS Plugin");
setName("OBS Plugin");
setCategory("OBS");
setCategory("OBS");
setVisibilityInPluginsPane(false);
setVisibilityInPluginsPane(false);
setAuthor("rnayabed");
setAuthor("rnayabed");
setHelpLink("https://github.com/Stream-Pi/EssentialActions");
setHelpLink("https://github.com/Stream-Pi/EssentialActions");
setVersion(new Version(1,0,0));
setVersion(new Version(1,1,0));
connectDisconnectButton = new Button("Connect");
connectDisconnectButton = new Button("Connect");
setServerSettingsButtonBar(connectDisconnectButton);
setServerSettingsButtonBar(connectDisconnectButton);
}
}
private Button connectDisconnectButton;
private Button connectDisconnectButton;
@Override
@Override
public void initProperties() throws Exception {
public void initProperties() throws Exception {
Property urlProperty = new Property("url", Type.STRING);
Property urlProperty = new Property("url", Type.STRING);
urlProperty.setDisplayName("URL");
urlProperty.setDisplayName("URL");
urlProperty.setDefaultValueStr("ws://localhost:4444");
urlProperty.setDefaultValueStr("ws://localhost:4444");
urlProperty.setCanBeBlank(false);
urlProperty.setCanBeBlank(false);
Property passwordProperty = new Property("pass", Type.STRING);
Property passwordProperty = new Property("pass", Type.STRING);
passwordProperty.setControlType(ControlType.TEXT_FIELD_MASKED);
passwordProperty.setDisplayName("Password");
passwordProperty.setDisplayName("Password");
Property connectOnStartupProperty = new Property("connect_on_startup", Type.BOOLEAN);
Property connectOnStartupProperty = new Property("connect_on_startup", Type.BOOLEAN);
connectOnStartupProperty.setDisplayName("Connect On Startup");
connectOnStartupProperty.setDisplayName("Connect On Startup");
connectOnStartupProperty.setDefaultValueBoolean(false);
connectOnStartupProperty.setDefaultValueBoolean(false);
addServerProperties(
addServerProperties(
urlProperty,
urlProperty,
passwordProperty,
passwordProperty,
connectOnStartupProperty
connectOnStartupProperty
);
);
}
}
@Override
@Override
public void initAction() throws Exception {
public void initAction() throws Exception {
connectDisconnectButton.setOnAction(action->{
connectDisconnectButton.setOnAction(action->{
try
try
{
{
if(MotherConnection.getRemoteController() == null)
if(MotherConnection.getRemoteController() == null)
{
{
connect(getURL(), getPassword());
connect(getURL(), getPassword());
}
}
else
else
{
{
MotherConnection.getRemoteController().disconnect();
MotherConnection.getRemoteController().disconnect();
}
}
}
}
catch (Exception e)
catch (Exception e)
{
{
e.printStackTrace();
e.printStackTrace();
}
}
});
});
if(isConnectOnStartup() && firstRun)
if(isConnectOnStartup() && firstRun)
{
{
connect(getURL(), getPassword());
connect(getURL(), getPassword());
}
}
firstRun = false;
firstRun = false;
}
}
private boolean firstRun = true;
private boolean firstRun = true;
private String getURL() throws MinorException
private String getURL() throws MinorException
{
{
return getServerProperties().getSingleProperty("url").getStringValue();
return getServerProperties().getSingleProperty("url").getStringValue();
}
}
private String getPassword() throws MinorException
private String getPassword() throws MinorException
{
{
return getServerProperties().getSingleProperty("pass").getStringValue();
return getServerProperties().getSingleProperty("pass").getStringValue();
}
}
private boolean isConnectOnStartup() throws MinorException
private boolean isConnectOnStartup() throws MinorException
{
{
return getServerProperties().getSingleProperty("connect_on_startup").getBoolValue();
return getServerProperties().getSingleProperty("connect_on_startup").getBoolValue();
}
}
private void connect(String url, String pass)
private void connect(String url, String pass)
{
{
new Thread(
new Thread(
new OBSActionConnectionTask(url, pass, connectDisconnectButton)
new OBSActionConnectionTask(url, pass, connectDisconnectButton)
).start();
).start();
}
}
@Override
@Override
public void onActionClicked() throws Exception {
public void onActionClicked() throws Exception {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
}
}
@Override
@Override
public void onShutDown() throws Exception
public void onShutDown() throws Exception
{
{
if(MotherConnection.getRemoteController() != null)
if(MotherConnection.getRemoteController() != null)
{
{
MotherConnection.getRemoteController().disconnect();
MotherConnection.getRemoteController().disconnect();
}
}
}
}
}
}