* onlay add files with mime type == video
pull/24/head
Jannik 5 years ago
parent d3ea1b1956
commit 23e46b7913

@ -32,8 +32,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.math.BigInteger;
import java.net.URLConnection;
@ -64,8 +62,6 @@ import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Label;
@ -73,7 +69,6 @@ import javafx.scene.control.MenuItem;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextArea;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeTableColumn;
import javafx.scene.control.TreeTableColumn.SortType;
@ -82,9 +77,7 @@ import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
@ -139,8 +132,6 @@ public class MainWindowController {
@FXML
private JFXButton settingsBtn;
@FXML
private JFXButton debugBtn;
@FXML
private JFXButton updateBtn;
@FXML
private JFXButton addDirectoryBtn;
@ -227,7 +218,6 @@ public class MainWindowController {
private String omdbAPIKey;
// text strings
private String errorPlay;
private String errorLoad;
private String errorSave;
private String infoText;
@ -443,7 +433,7 @@ public class MainWindowController {
}
}
} else {
System.out.println("ascending");
// System.out.println("ascending");
for (FilmTabelDataType film : filmsList) {
if (!film.getFavorite()) {
filterData.add(0, film);
@ -491,9 +481,6 @@ public class MainWindowController {
// initialize UI elements
private void initUI() {
debugBtn.setDisable(true); // debugging button for tests
debugBtn.setVisible(false);
versionLbl.setText("Version: " + version + " (Build: " + buildNumber + ")");
fontsizeSlider.setValue(getFontSize());
colorPicker.setValue(Color.valueOf(getColor()));
@ -546,16 +533,16 @@ public class MainWindowController {
} else {
try {
new ProcessBuilder("vlc", getCurrentStreamUrl()).start();
} catch (IOException e1) {
showErrorMsg(errorPlay, e1);
} catch (IOException e) {
LOGGER.warn("An error has occurred while opening the file!", e);
}
}
} else if (System.getProperty("os.name").contains("Windows") || System.getProperty("os.name").contains("Mac OS X")) {
try {
Desktop.getDesktop().open(new File(getCurrentStreamUrl()));
} catch (IOException e1) {
showErrorMsg(errorPlay, e1);
} catch (IOException e) {
LOGGER.warn("An error has occurred while opening the file!", e);
}
} else {
LOGGER.error(System.getProperty("os.name") + ", OS is not supported, please contact a developer! ");
@ -616,11 +603,6 @@ public class MainWindowController {
}
}
@FXML
private void debugBtnclicked(){
//for testing
}
@FXML
private void addDirectoryBtnAction(){
DirectoryChooser directoryChooser = new DirectoryChooser();
@ -768,7 +750,6 @@ public class MainWindowController {
dialogBtnStyle = btnStyleWhite;
settingsBtn.setStyle("-fx-text-fill: WHITE;");
aboutBtn.setStyle("-fx-text-fill: WHITE;");
debugBtn.setStyle("-fx-text-fill: WHITE;");
addDirectoryBtn.setStyle(btnStyleWhite);
addStreamSourceBtn.setStyle(btnStyleWhite);
updateBtn.setStyle(btnStyleWhite);
@ -784,7 +765,6 @@ public class MainWindowController {
dialogBtnStyle = btnStyleBlack;
settingsBtn.setStyle("-fx-text-fill: BLACK;");
aboutBtn.setStyle("-fx-text-fill: BLACK;");
debugBtn.setStyle("-fx-text-fill: BLACK;");
addDirectoryBtn.setStyle(btnStyleBlack);
addStreamSourceBtn.setStyle(btnStyleBlack);
updateBtn.setStyle(btnStyleBlack);
@ -853,46 +833,12 @@ public class MainWindowController {
columnSeason.setText(getBundle().getString("columnSeason"));
columnEpisode.setText(getBundle().getString("columnEpisode"));
columnFavorite.setText(getBundle().getString("columnFavorite"));
errorPlay = getBundle().getString("errorPlay");
errorLoad = getBundle().getString("errorLoad");
errorSave = getBundle().getString("errorSave");
infoText = getBundle().getString("infoText");
vlcNotInstalled = getBundle().getString("vlcNotInstalled");
}
// TODO rework after #19 has landed
public void showErrorMsg(String msg, Exception exception) {
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Error");
alert.setHeaderText("");
alert.setContentText(msg);
alert.initOwner(main.getPrimaryStage());
// Create expandable Exception.
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
exception.printStackTrace(pw);
String exceptionText = sw.toString();
TextArea textArea = new TextArea(exceptionText);
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setMaxWidth(Double.MAX_VALUE);
textArea.setMaxHeight(Double.MAX_VALUE);
GridPane.setVgrow(textArea, Priority.ALWAYS);
GridPane.setHgrow(textArea, Priority.ALWAYS);
GridPane expContent = new GridPane();
expContent.setMaxWidth(Double.MAX_VALUE);
expContent.add(textArea, 0, 1);
// Set expandable Exception into the dialog pane.
alert.getDialogPane().setExpandableContent(expContent);
alert.showAndWait();
LOGGER.error("An error occurred", exception);
}
/**
* save the configuration to the config.xml file
*/

@ -68,8 +68,8 @@ public class DBController {
/**
* constructor for DBController
* @param main the main object
* @param mainWindowController the mainWindowController object
* @param main the Main object
* @param mainWindowController the MainWindowController object
*/
public DBController(Main main, MainWindowController mainWindowController) {
this.main = main;
@ -300,11 +300,11 @@ public class DBController {
*/
private void checkRemoveEntry() {
LOGGER.info("checking for entrys to remove to DB ...");
try {
Statement stmt = connection.createStatement();
for (String entry : filmsdbStreamURL) {
// if the directory doen't contain the entry form the db, remove it
if (!filmsStreamURL.contains(entry)) {
stmt.executeUpdate("delete from films where streamUrl = \"" + entry + "\"");
connection.commit();
@ -334,8 +334,9 @@ public class DBController {
// if it's a local source check the folder for new film
if (source.getMode().equals("local")) {
for (File file : new File(source.getPath()).listFiles()) {
if (file.isFile()) {
String mimeType = URLConnection.guessContentTypeFromName(file.getPath());
// if file is file and has mime type "video" TODO needs testing
if (file.isFile() && mimeType != null && mimeType.contains("video")) {
// get all files (films)
if (!filmsdbStreamURL.contains(file.getPath())) {
stmt.executeUpdate("insert into films values ("
@ -346,7 +347,7 @@ public class DBController {
LOGGER.info("Added \"" + file.getName() + "\" to database");
filmsdbStreamURL.add(file.getPath());
}
} else {
} else if (file.isDirectory()) {
// get all folders (series)
int sn = 1;
for (File season : file.listFiles()) {

@ -48,6 +48,12 @@ public class OMDbAPIController implements Runnable {
private String URL = "https://www.omdbapi.com/?apikey=";
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
/**
* constructor for the OMDbAPIController
* @param mainWindowController the MainWindowController object
* @param dbController the DBController object
* @param main the Main object
*/
public OMDbAPIController(MainWindowController mainWindowController, DBController dbController, Main main){
this.mainWindowController = mainWindowController;
this.dbController = dbController;
@ -107,6 +113,7 @@ public class OMDbAPIController implements Runnable {
return;
}
// add the response to the responseString[]
responseString[0] = object.getString("Title", "");
responseString[1] = object.getString("Year", "");
responseString[2] = object.getString("Rated", "");

@ -60,6 +60,9 @@ public class UpdateController implements Runnable {
/**
* updater for Project HomeFlix based on cemu_UIs, checks for Updates and download it
* @param mwc the MainWindowController object
* @param buildNumber the buildNumber of the used HomeFlix version
* @param useBeta if the updater should query the beta channel
*/
public UpdateController(MainWindowController mwc, String buildNumber, boolean useBeta) {
mainWindowController = mwc;

@ -22,7 +22,7 @@
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.TextFlow?>
<AnchorPane fx:id="mainAnchorPane" prefHeight="600.0" prefWidth="1000.0" xmlns="http://javafx.com/javafx/9" xmlns:fx="http://javafx.com/fxml/1" fx:controller="kellerkinder.HomeFlix.application.MainWindowController">
<AnchorPane fx:id="mainAnchorPane" prefHeight="600.0" prefWidth="1000.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="kellerkinder.HomeFlix.application.MainWindowController">
<children>
<AnchorPane fx:id="tableModeAnchorPane" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="32.0">
<children>
@ -190,11 +190,6 @@
<Font name="System Bold" size="15.0" />
</font>
</JFXButton>
<JFXButton fx:id="debugBtn" onAction="#debugBtnclicked" prefHeight="32.0" prefWidth="150.0" text="debugging" textAlignment="CENTER">
<font>
<Font name="System Bold" size="15.0" />
</font>
</JFXButton>
</children>
</VBox>
</children>

@ -33,7 +33,6 @@ columnFavorite = Favorit
#error translations
errorUpdateV = Beim ausf\u00FChren des Updates ist ein Fehler aufgetreten! \nError: could not check update version (nvc)\nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz
errorUpdateD = Beim ausf\u00FChren des Updates ist ein Fehler aufgetreten! \nError: could not download update files (ndf)\nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz
errorPlay = Beim \u00F6ffnen der Datei ist ein Fehler aufgetreten! \nError: could not open file (nof) \nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz
errorMode = Oh, da lief etwas falsch! Da hat jemand einen falschen Modus verwendet. \nError: mode unknow (muk)\nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz
errorOpenStream = Beim \u00F6ffnen des Streams ist ein Fehler aufgetreten!
errorLoad = Beim laden der Einstellungen ist ein Fehler aufgetreten!

@ -33,7 +33,6 @@ columnFavorite = Favorite
#error translations
errorUpdateV = An error has occurred during update! \nError: could not check update version (nvc) \nTo get help, visit www.kellerkinder.xyz \nor contcat support@kellerkinder.xyz
errorUpdateD = An error has occurred during update! \nError: could not download update files (ndf) \nTo get help, visit www.kellerkinder.xyz \nor contcat support@kellerkinder.xyz
errorPlay = An error has occurred during opening the file! \nError: could not open file (nof) \nTo get help, visit www.kellerkinder.xyz \nor contcat support@kellerkinder.xyz
errorMode = Oh, something went wrong! It seems someone has used a wrong mode. \nError: mode unknow (muk) \nTo get help, visit www.kellerkinder.xyz \nor contcat support@kellerkinder.xyz
errorOpenStream = An error has occurred during opening the stream!
errorLoad = An error occurred while loading the settings!

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close