Finally fixed sound starting on some videos. Simply used -ao null. Cleaned up formatting of code and changed import order, etc.

This commit is contained in:
Maxim 2017-10-23 15:52:08 -05:00
parent ba50123ab9
commit 2aa974137c
12 changed files with 83 additions and 92 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1,8 +1,8 @@
Package: fxwinwrap Package: fxwinwrap64
Version: 0.1-3 Version: 0.1-3
Section: base Section: base
Priority: optional Priority: optional
Architecture: i386 Architecture: amd64
Depends: openjdk-8-jre (>= 8u45-b14-1), openjfx (>= 8u60-b27-4), ffmpegthumbnailer (>= 2.0.10-0.1), mplayer2 (>=2.0-728-g2c378c7-4), gifsicle (>=1.86-1), nitrogen (>=1.5.2-2) Depends: openjdk-8-jre (>= 8u45-b14-1), openjfx (>= 8u60-b27-4), ffmpegthumbnailer (>= 2.0.10-0.1), mplayer2 (>=2.0-728-g2c378c7-4), gifsicle (>=1.86-1), nitrogen (>=1.5.2-2)
Maintainer: Maxim Stewart 1itdominator@gmail.com Maintainer: Maxim Stewart 1itdominator@gmail.com
Description: A GUI to handle setting XWinWrap options. Description: A GUI to handle setting XWinWrap options.

View File

@ -1,4 +1,5 @@
import javafx.stage.*; import javafx.stage.Stage;
import javafx.stage.DirectoryChooser;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.image.Image; import javafx.scene.image.Image;
@ -11,12 +12,17 @@ import javafx.scene.input.KeyEvent;
import javafx.scene.input.KeyCode; import javafx.scene.input.KeyCode;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import java.io.*;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Task; import javafx.concurrent.Task;
import javafx.application.Platform; import javafx.application.Platform;
import java.io.File;
import java.io.UncheckedIOException;
import java.io.IOException;
import java.io.FileWriter;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
public class Controller { public class Controller {
private DirectoryChooser folderChooser = new DirectoryChooser(); // Selects a dir private DirectoryChooser folderChooser = new DirectoryChooser(); // Selects a dir
@ -26,9 +32,8 @@ public class Controller {
private Image pth = new Image("."); // Path to image private Image pth = new Image("."); // Path to image
private ImageView imgView = new ImageView(pth); // Image view area private ImageView imgView = new ImageView(pth); // Image view area
private Process pb; // Process runner private Process pb; // Process runner
private String tmpPath, resolution, xScreenVal, output, private String tmpPath, resolution, xScreenVal, output, textAreaPth = "",
startScrpt = System.getProperty("user.dir") + "/resources/bin/StartXWW.sh", // Gets shell that starts stuff local startScrpt = System.getProperty("user.dir") + "/resources/bin/StartXWW.sh"; // Gets shell that starts stuff local
textAreaPth = "";
private int applyType = 1; private int applyType = 1;
private Stage fileChooserStage; private Stage fileChooserStage;
@FXML private ListView<?> selXScreenSvr; @FXML private ListView<?> selXScreenSvr;
@ -37,10 +42,8 @@ public class Controller {
@FXML private TextField dirPathField, filePathField; // Text fields @FXML private TextField dirPathField, filePathField; // Text fields
@FXML private CheckBox useXSvrn; // Check boxes @FXML private CheckBox useXSvrn; // Check boxes
@FXML private ChoiceBox<?> playbackResolution, setMonPosOffset, listSaveLoc; // Choice box fields @FXML private ChoiceBox<?> playbackResolution, setMonPosOffset, listSaveLoc; // Choice box fields
@FXML private Button applyBttn, closeBttn, fileBttn, clear, // Buttons @FXML private Button applyBttn, closeBttn, fileBttn, clear, killBttn, saveBttn; // Buttons
killBttn, saveBttn;
// This method is called by the FXMLLoader when initialization is complete
@FXML void initialize() throws Exception { @FXML void initialize() throws Exception {
assert dirPathField != null : "fx:id=\"dirPathField\" was not injected: check your FXML file 'Window.fxml'."; assert dirPathField != null : "fx:id=\"dirPathField\" was not injected: check your FXML file 'Window.fxml'.";
assert clear != null : "fx:id=\"clear\" was not injected: check your FXML file 'Window.fxml'."; assert clear != null : "fx:id=\"clear\" was not injected: check your FXML file 'Window.fxml'.";
@ -53,22 +56,15 @@ public class Controller {
assert setMonPosOffset != null : "fx:id=\"setMonPosOffset\" was not injected: check your FXML file 'Window.fxml'."; assert setMonPosOffset != null : "fx:id=\"setMonPosOffset\" was not injected: check your FXML file 'Window.fxml'.";
assert playbackResolution != null : "fx:id=\"playbackResolution\" was not injected: check your FXML file 'Window.fxml'."; assert playbackResolution != null : "fx:id=\"playbackResolution\" was not injected: check your FXML file 'Window.fxml'.";
assert useXSvrn != null : "fx:id=\"useXSvrn\" was not injected: check your FXML file 'Window.fxml'."; assert useXSvrn != null : "fx:id=\"useXSvrn\" was not injected: check your FXML file 'Window.fxml'.";
// Initialize your logic here: all @FXML variables will have been injected
} }
// Handler for TextArea[fx:id="dirPathField"] onKeyReleased
@FXML void setNewDir(MouseEvent event) { newDir(); } @FXML void setNewDir(MouseEvent event) { newDir(); }
@FXML void onEnter(KeyEvent event) { @FXML void onEnter(KeyEvent event) {
if (event.getCode().equals(KeyCode.ENTER)) { if (event.getCode().equals(KeyCode.ENTER)) {
textAreaPth = dirPathField.getText(); textAreaPth = dirPathField.getText();
System.out.println(textAreaPth); System.out.println(textAreaPth);
newDir(); newDir();
} } else {}
else {}
}
@FXML void test(ActionEvent event) {
newDir();
} }
// Scan selected dir // Scan selected dir
@ -103,15 +99,14 @@ public class Controller {
newDir2(); newDir2();
return null; return null;
}}; }};
new Thread(getDir).start(); new Thread(getDir).start();
} }
public void newDir2() { public void newDir2() {
for (int i=0; i<fileList.length; i++) { for (int i=0; i<fileList.length; i++) {
String path = "" + fileList[i]; String path = "" + fileList[i], tmpP = "" + fileList[i];
if (path.toLowerCase().matches("^.*?(mp4|mpeg|mpg|wmv|mkv|flv|webm|avi).*$")) { if (tmpP.toLowerCase().matches("^.*?(mp4|mpeg|mpg|wmv|mkv|flv|webm|avi).*$")) {
String movieImg = "ffmpegthumbnailer -w -t='00:30:00' -c png -i " + fileList[i] + String movieImg = "ffmpegthumbnailer -w -t='00:30:00' -c png -i " +
" -s 300 -o /tmp/image.png", fileList[i] + " -s 300 -o /tmp/image.png",
vExec = "mplayer " + fileList[i]; vExec = "mplayer " + fileList[i];
try { try {
pb = Runtime.getRuntime().exec(movieImg); pb = Runtime.getRuntime().exec(movieImg);
@ -123,10 +118,9 @@ public class Controller {
ImageView view = (ImageView) (tilePane.getChildren().get(i)); ImageView view = (ImageView) (tilePane.getChildren().get(i));
pth = new Image("file:///tmp/image.png"); pth = new Image("file:///tmp/image.png");
Platform.runLater(new Runnable() { Platform.runLater(new Runnable() {
@Override public void run() { @Override public void run() { view.setImage(pth); }
view.setImage(pth);
}
}); });
view.setOnMouseClicked(mouse -> { view.setOnMouseClicked(mouse -> {
if (mouse.getClickCount() == 2 && !mouse.isConsumed()) { if (mouse.getClickCount() == 2 && !mouse.isConsumed()) {
mouse.consume(); mouse.consume();
@ -138,17 +132,16 @@ public class Controller {
} }
filePathField.setText(path); filePathField.setText(path);
}); });
} else if(path.toLowerCase().matches("^.*?(png|jpg|jpeg|gif).*$")) { } else if(tmpP.toLowerCase().matches("^.*?(png|jpg|jpeg|gif).*$")) {
String title = "" + fileList[i];
pth = new Image("file://" + fileList[i]);
ImageView view = (ImageView) (tilePane.getChildren().get(i)); ImageView view = (ImageView) (tilePane.getChildren().get(i));
String title = "file://" + fileList[i];
pth = new Image(title);
Platform.runLater(new Runnable() { Platform.runLater(new Runnable() {
@Override public void run() { @Override public void run() { view.setImage(pth); }
view.setImage(pth);
}
}); });
final ImageView imgViewPoped = new ImageView("file://" + fileList[i]);
final ImageView imgViewPoped = new ImageView(title);
// image click actions // image click actions
view.setOnMouseClicked(mouse -> { view.setOnMouseClicked(mouse -> {
if (mouse.getClickCount() == 2 && !mouse.isConsumed()) { if (mouse.getClickCount() == 2 && !mouse.isConsumed()) {
@ -157,9 +150,7 @@ public class Controller {
} }
filePathField.setText(path); filePathField.setText(path);
}); });
} else { } else { System.out.println("Not a video or image file."); }
System.out.println("Not a video or image file.");
}
} }
} }
// Open image in new window // Open image in new window
@ -228,7 +219,7 @@ public class Controller {
applyType = 2; applyType = 2;
//VIDEO //VIDEO
} else { } else {
output = "xwinwrap -ov -g " + resolution + " -st -sp -b -nf -s -ni -- mplayer -wid WID -really-quiet -nosound -loop 0 " + filePathField.getText(); output = "xwinwrap -ov -g " + resolution + " -st -sp -b -nf -s -ni -- mplayer -wid WID -really-quiet -ao null -loop 0 " + filePathField.getText();
fileWriter.write(output); fileWriter.write(output);
applyType = 1; applyType = 1;
} }