Skip to content

Commit

Permalink
fix stream/chat handling from jar
Browse files Browse the repository at this point in the history
  • Loading branch information
s1mpl3x committed Apr 29, 2014
1 parent a9593c1 commit 5965363
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 7 deletions.
24 changes: 24 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,31 @@
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>eu.over9000.skadi.SkadiMain</Main-Class>
<Build-Number>123</Build-Number>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>


</project>
1 change: 1 addition & 0 deletions src/main/java/eu/over9000/skadi/SkadiMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,6 @@ public void setChannels(final TreeMap<String, ChannelInstance> newChannels) {
public void deleteChannel(final ChannelInstance channel) {
this.channels.remove(channel.getURL());
channel.closeStreamAndChat();
SkadiGUI.handleChannelListUpdate();
}
}
6 changes: 4 additions & 2 deletions src/main/java/eu/over9000/skadi/handler/ChatHandler.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package eu.over9000.skadi.handler;

import java.io.File;
import java.io.IOException;

import eu.over9000.skadi.SkadiMain;
import eu.over9000.skadi.channel.ChannelInstance;
import eu.over9000.skadi.io.PersistenceManager;

public class ChatHandler extends Thread {

Expand All @@ -23,9 +25,9 @@ private ChatHandler(final ChannelInstance instance, final String url) throws IOE
this.instance = instance;
this.setName("ChatHandler Thread for " + url);

final File logFile = new File(PersistenceManager.CHAT_LOG_FILE);
this.process = new ProcessBuilder(SkadiMain.getInstance().chrome_exec, "--app=" + url + "chat?popout=true",
"--window-size=350,720").inheritIO().start();

"--window-size=350,720").redirectError(logFile).redirectOutput(logFile).start();
this.start();
}

Expand Down
7 changes: 6 additions & 1 deletion src/main/java/eu/over9000/skadi/handler/StreamHandler.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package eu.over9000.skadi.handler;

import java.io.File;
import java.io.IOException;

import eu.over9000.skadi.SkadiMain;
import eu.over9000.skadi.channel.ChannelInstance;
import eu.over9000.skadi.io.PersistenceManager;

public class StreamHandler extends Thread {

Expand All @@ -24,7 +26,10 @@ private StreamHandler(final ChannelInstance instance, final String url, final St

this.setName("StreamHandler Thread for " + url);

this.process = new ProcessBuilder(SkadiMain.getInstance().livestreamer_exec, url, quality).inheritIO().start();
final File logFile = new File(PersistenceManager.STREAM_LOG_FILE);

this.process = new ProcessBuilder(SkadiMain.getInstance().livestreamer_exec, url, quality,
"-a --play-and-exit {filename}").redirectError(logFile).redirectOutput(logFile).start();

this.start();
}
Expand Down
11 changes: 7 additions & 4 deletions src/main/java/eu/over9000/skadi/io/PersistenceManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@
public class PersistenceManager {
private static PersistenceManager instance;

private static final String persistanceDir = System.getProperty("user.home") + File.separator + ".skadi"
private static final String PERSISTENCE_DIRECTORY = System.getProperty("user.home") + File.separator + ".skadi"
+ File.separator;
private static final String persistanceFile = "skadi_data.xml";
private static final String PERSISTENCE_FILE = "skadi_data.xml";

public static final String CHAT_LOG_FILE = PersistenceManager.PERSISTENCE_DIRECTORY + "chat_output.log";
public static final String STREAM_LOG_FILE = PersistenceManager.PERSISTENCE_DIRECTORY + "stream_output.log";

private final File dataFile;

Expand All @@ -42,10 +45,10 @@ public static PersistenceManager getInstance() {
}

private PersistenceManager() {
final File dir = new File(PersistenceManager.persistanceDir);
final File dir = new File(PersistenceManager.PERSISTENCE_DIRECTORY);
dir.mkdirs();

this.dataFile = new File(PersistenceManager.persistanceDir + PersistenceManager.persistanceFile);
this.dataFile = new File(PersistenceManager.PERSISTENCE_DIRECTORY + PersistenceManager.PERSISTENCE_FILE);

if (!this.dataFile.exists()) {
try {
Expand Down

0 comments on commit 5965363

Please sign in to comment.