release 0.8.0 #12
| @ -1,7 +1,7 @@ | ||||
| /** | ||||
|  * Project-HomeFlix | ||||
|  * | ||||
|  * Copyright 2016-2018  <@Seil0> | ||||
|  * Copyright 2016-2019  <@Seil0> | ||||
|  *  | ||||
|  * This program is free software; you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
| @ -21,25 +21,15 @@ | ||||
|  */ | ||||
| package kellerkinder.HomeFlix.application; | ||||
|  | ||||
| import java.io.BufferedReader; | ||||
| import java.io.File; | ||||
| import java.io.FileInputStream; | ||||
| import java.io.FileOutputStream; | ||||
| import java.io.IOException; | ||||
| import java.io.InputStream; | ||||
| import java.io.InputStreamReader; | ||||
| import java.io.OutputStream; | ||||
| import java.util.Locale; | ||||
| import java.util.Properties; | ||||
| import java.util.ResourceBundle; | ||||
|  | ||||
| import org.apache.logging.log4j.LogManager; | ||||
| import org.apache.logging.log4j.Logger; | ||||
| import org.kellerkinder.Alerts.JFX2BtnCancelAlert; | ||||
|  | ||||
| import com.eclipsesource.json.Json; | ||||
| import com.eclipsesource.json.JsonObject; | ||||
|  | ||||
| import javafx.application.Application; | ||||
| import javafx.event.ActionEvent; | ||||
| import javafx.event.EventHandler; | ||||
| @ -50,6 +40,7 @@ import javafx.scene.layout.AnchorPane; | ||||
| import javafx.stage.DirectoryChooser; | ||||
| import javafx.stage.FileChooser; | ||||
| import javafx.stage.Stage; | ||||
| import kellerkinder.HomeFlix.controller.XMLController; | ||||
|  | ||||
| public class Main extends Application { | ||||
|  | ||||
| @ -57,27 +48,15 @@ public class Main extends Application { | ||||
| 	private Scene scene; | ||||
| 	private AnchorPane pane; | ||||
| 	private MainWindowController mainWindowController; | ||||
| 	private static String userHome = System.getProperty("user.home"); | ||||
| 	private static String userName = System.getProperty("user.name"); | ||||
| 	private static String osName = System.getProperty("os.name"); | ||||
| 	private static String osArch = System.getProperty("os.arch"); | ||||
| 	private static String osVers = System.getProperty("os.version"); | ||||
| 	private static String javaVers = System.getProperty("java.version"); | ||||
| 	private static String javaVend = System.getProperty("java.vendor"); | ||||
| 	private static String local = System.getProperty("user.language") + "_" + System.getProperty("user.country"); | ||||
| 	private static String dirHomeFlix; | ||||
| 	private static File directory; | ||||
| 	private static File configFile; | ||||
| 	private static File posterCache; | ||||
| 	private static XMLController xmlController; | ||||
| 	private ResourceBundle bundle; | ||||
| 	private static Logger LOGGER; | ||||
| 	private Properties props = new Properties(); | ||||
|  | ||||
| 	@Override | ||||
| 	public void start(Stage primaryStage) throws IOException { | ||||
| 		LOGGER.info("OS: " + osName + " " + osVers + " " + osArch); | ||||
| 		LOGGER.info("Java: " + javaVend + " " + javaVers); | ||||
| 		LOGGER.info("User: " + userName + " " + userHome); | ||||
| 		LOGGER.info("OS: " + XMLController.getOsName() + " " + XMLController.getOsVers() + " " + XMLController.getOsVers()); | ||||
| 		LOGGER.info("Java: " + XMLController.getJavaVend() + " " + XMLController.getJavaVers()); | ||||
| 		LOGGER.info("User: " + XMLController.getUserName() + " " + XMLController.getUserHome()); | ||||
|  | ||||
| 		this.primaryStage = primaryStage; | ||||
| 		mainWindowController = new MainWindowController(this); | ||||
| @ -109,20 +88,16 @@ public class Main extends Application { | ||||
| 			primaryStage.show(); // show stage | ||||
| 			 | ||||
| 			// startup checks | ||||
| 			if (!configFile.exists()) { | ||||
| 				directory.mkdir(); | ||||
| 			if (!XMLController.getConfigFile().exists()) { | ||||
| 				XMLController.getDirHomeFlix().mkdir(); | ||||
| 				System.out.println("config not found"); | ||||
|  | ||||
| 				addFirstSource(); | ||||
| 				mainWindowController.setColor("ee3523"); | ||||
| 				mainWindowController.setFontSize(17.0); | ||||
| 				mainWindowController.setAutoUpdate(false); | ||||
| 				mainWindowController.setLocal(local); | ||||
| 				saveSettings(); | ||||
| 				xmlController.saveSettings(); | ||||
| 			} | ||||
|  | ||||
| 			if (!posterCache.exists()) { | ||||
| 				posterCache.mkdir(); | ||||
| 			if (!XMLController.getPosterCache().exists()) { | ||||
| 				XMLController.getPosterCache().mkdir(); | ||||
| 			} | ||||
| 			 | ||||
| 			mainWindowController.init(); | ||||
| @ -136,31 +111,30 @@ public class Main extends Application { | ||||
| 	 * @param args arguments given at the start | ||||
| 	 */ | ||||
| 	public static void main(String[] args) { | ||||
|  | ||||
| 		if (osName.contains("Windows")) { | ||||
| 			dirHomeFlix = userHome + "/Documents/HomeFlix"; | ||||
| 		// Logger initialization | ||||
| 		String logPath = ""; | ||||
| 		 | ||||
| 		if (System.getProperty("os.name").contains("Windows")) { | ||||
| 			logPath = System.getProperty("user.home") + "/Documents/HomeFlix/app.log"; | ||||
| 		} else { | ||||
| 			dirHomeFlix = userHome + "/HomeFlix"; | ||||
| 			logPath = System.getProperty("user.home") + "/HomeFlix/app.log"; | ||||
| 		} | ||||
| 		 | ||||
| 		// set the concrete files | ||||
| 		directory = new File(dirHomeFlix); | ||||
| 		configFile = new File(dirHomeFlix + "/config.xml"); | ||||
| 		posterCache = new File(dirHomeFlix + "/posterCache"); | ||||
|  | ||||
| 		System.setProperty("logFilename", dirHomeFlix + "/app.log"); | ||||
| 		File logFile = new File(dirHomeFlix + "/app.log"); | ||||
| 		System.setProperty("logFilename", logPath); | ||||
| 		File logFile = new File(logPath); | ||||
| 		logFile.delete(); | ||||
| 		LOGGER = LogManager.getLogger(Main.class.getName()); | ||||
| 		 | ||||
| 		xmlController = new XMLController(); | ||||
| 		launch(args); | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	/** TODO this should move | ||||
| 	 * we need to get the path for the first source from the user and add it to  | ||||
| 	 * sources.json, if the user ends the file-/directory-chooser the program will exit | ||||
| 	 */ | ||||
| 	void addFirstSource() { | ||||
| 		switch (local) { | ||||
| 		switch (XMLController.getSysLocal()) { | ||||
| 		case "en_US": | ||||
| 			bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US); // us_english | ||||
| 			break; | ||||
| @ -217,103 +191,6 @@ public class Main extends Application { | ||||
| 		selectFirstSource.showAndWait(); | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * save the configuration to the config.xml file | ||||
| 	 */ | ||||
| 	public void saveSettings() { | ||||
| 		LOGGER.info("saving settings ..."); | ||||
| 		try { | ||||
| 			props.setProperty("color", mainWindowController.getColor()); | ||||
| 			props.setProperty("autoUpdate", String.valueOf(mainWindowController.isAutoUpdate())); | ||||
| 			props.setProperty("useBeta", String.valueOf(mainWindowController.isUseBeta())); | ||||
| 			props.setProperty("autoplay", String.valueOf(mainWindowController.isAutoplay())); | ||||
| 			props.setProperty("size", mainWindowController.getFontSize().toString()); | ||||
| 			props.setProperty("local", mainWindowController.getLocal()); | ||||
|  | ||||
| 			OutputStream outputStream = new FileOutputStream(getConfigFile()); // new output-stream | ||||
| 			props.storeToXML(outputStream, "Project HomeFlix settings"); // write new .xml | ||||
| 			outputStream.close(); | ||||
| 		} catch (IOException e) { | ||||
| 			LOGGER.error("An error occurred while saving the settings!", e); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * load the configuration from the config.xml file | ||||
| 	 * and try to load the API keys from apiKeys.json | ||||
| 	 */ | ||||
| 	public void loadSettings() { | ||||
| 		LOGGER.info("loading settings ..."); | ||||
| 		 | ||||
| 		try { | ||||
| 			InputStream inputStream = new FileInputStream(getConfigFile()); | ||||
| 			props.loadFromXML(inputStream); // new input-stream from .xml | ||||
|  | ||||
| 			try { | ||||
| 				mainWindowController.setColor(props.getProperty("color")); | ||||
| 			} catch (Exception e) { | ||||
| 				LOGGER.error("cloud not load color", e); | ||||
| 				mainWindowController.setColor("00a8cc"); | ||||
| 			} | ||||
|  | ||||
| 			try { | ||||
| 				mainWindowController.setFontSize(Double.parseDouble(props.getProperty("size"))); | ||||
| 			} catch (Exception e) { | ||||
| 				LOGGER.error("cloud not load fontsize", e); | ||||
| 				mainWindowController.setFontSize(17.0); | ||||
| 			} | ||||
|  | ||||
| 			try { | ||||
| 				mainWindowController.setAutoUpdate(Boolean.parseBoolean(props.getProperty("autoUpdate"))); | ||||
| 			} catch (Exception e) { | ||||
| 				LOGGER.error("cloud not load autoUpdate", e); | ||||
| 				mainWindowController.setAutoUpdate(false); | ||||
| 			} | ||||
| 			 | ||||
| 			try { | ||||
| 				mainWindowController.setUseBeta(Boolean.parseBoolean(props.getProperty("useBeta"))); | ||||
| 			} catch (Exception e) { | ||||
| 				LOGGER.error("cloud not load autoUpdate", e); | ||||
| 				mainWindowController.setUseBeta(false); | ||||
| 			} | ||||
| 			 | ||||
| 			try { | ||||
| 				mainWindowController.setAutoplay(Boolean.parseBoolean(props.getProperty("autoplay"))); | ||||
| 			} catch (Exception e) { | ||||
| 				LOGGER.error("cloud not load autoplay", e); | ||||
| 				mainWindowController.setAutoplay(false); | ||||
| 			} | ||||
|  | ||||
| 			try { | ||||
| 				mainWindowController.setLocal(props.getProperty("local")); | ||||
| 			} catch (Exception e) { | ||||
| 				LOGGER.error("cloud not load local", e); | ||||
| 				mainWindowController.setLocal(System.getProperty("user.language") + "_" + System.getProperty("user.country")); | ||||
| 			} | ||||
|  | ||||
| 			inputStream.close(); | ||||
| 		} catch (IOException e) { | ||||
| 			LOGGER.error("An error occurred while loading the settings!", e); | ||||
| 		} | ||||
| 		 | ||||
| 		// try loading the omdbAPI key | ||||
| 		try { | ||||
| 			InputStream in = getClass().getClassLoader().getResourceAsStream("apiKeys.json"); | ||||
| 			if (in != null) { | ||||
| 				BufferedReader reader = new BufferedReader(new InputStreamReader(in)); | ||||
| 				JsonObject apiKeys = Json.parse(reader).asObject(); | ||||
| 				mainWindowController.setOmdbAPIKey(apiKeys.getString("omdbAPIKey", "")); | ||||
| 				reader.close(); | ||||
| 				in.close(); | ||||
| 			} else { | ||||
| 				LOGGER.warn("Cloud not load apiKeys.json. No such file"); | ||||
| 			} | ||||
| 		} catch (Exception e) { | ||||
| 			LOGGER.error("Cloud not load the omdbAPI key. Please contact the developer!", e); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|  | ||||
| 	public Stage getPrimaryStage() { | ||||
| 		return primaryStage; | ||||
| 	} | ||||
| @ -321,16 +198,4 @@ public class Main extends Application { | ||||
| 	public AnchorPane getPane() { | ||||
| 		return pane; | ||||
| 	} | ||||
|  | ||||
| 	public File getDirectory() { | ||||
| 		return directory; | ||||
| 	} | ||||
|  | ||||
| 	public File getConfigFile() { | ||||
| 		return configFile; | ||||
| 	} | ||||
|  | ||||
| 	public File getPosterCache() { | ||||
| 		return posterCache; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| /** | ||||
|  * Project-HomeFlix | ||||
|  * | ||||
|  * Copyright 2016-2018  <@Seil0> | ||||
|  * Copyright 2016-2019  <@Seil0> | ||||
|  *  | ||||
|  * This program is free software; you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
| @ -86,6 +86,7 @@ import javafx.util.Duration; | ||||
| import kellerkinder.HomeFlix.controller.DBController; | ||||
| import kellerkinder.HomeFlix.controller.OMDbAPIController; | ||||
| import kellerkinder.HomeFlix.controller.UpdateController; | ||||
| import kellerkinder.HomeFlix.controller.XMLController; | ||||
| import kellerkinder.HomeFlix.datatypes.SourceDataType; | ||||
| import kellerkinder.HomeFlix.player.Player; | ||||
| import kellerkinder.HomeFlix.datatypes.FilmTabelDataType; | ||||
| @ -153,29 +154,22 @@ public class MainWindowController { | ||||
|  | ||||
| 	// poster-mode | ||||
| //	@FXML private AnchorPane posterModeAnchorPane; | ||||
|  | ||||
| 	 | ||||
| 	private Main main; | ||||
| 	private MainWindowController mainWindowController; | ||||
| 	private UpdateController updateController; | ||||
| 	private DBController dbController; | ||||
| 	private XMLController xmlController; | ||||
| 	private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName()); | ||||
| 	 | ||||
| 	private boolean menuTrue = false; | ||||
| 	private boolean settingsTrue = false; | ||||
| 	private boolean autoUpdate = false; | ||||
| 	private boolean useBeta = false; | ||||
| 	private boolean autoplay = false; | ||||
|  | ||||
| 	private final String version = "0.7.0"; | ||||
| 	private final String buildNumber = "165"; | ||||
| 	private final String buildNumber = "167"; | ||||
| 	private final String versionName = "toothless dragon"; | ||||
| 	private String btnStyle; | ||||
| 	private String color; | ||||
| 	private String local; | ||||
| 	private String omdbAPIKey; | ||||
| 	 | ||||
| 	private double fontSize; | ||||
| 	private final int hashA = -647380320; | ||||
| 	private int last; | ||||
| 	private int indexTable; | ||||
| @ -200,14 +194,15 @@ public class MainWindowController { | ||||
| 	public MainWindowController(Main main) { | ||||
| 		this.main = main; | ||||
| 		mainWindowController = this; | ||||
| 		dbController = new DBController(this.main, this); | ||||
| 		xmlController = new XMLController(); // TODO pass it over from main? | ||||
| 		dbController = new DBController(this); | ||||
| 	} | ||||
| 	 | ||||
| 	 | ||||
|     public void init() { | ||||
| 		LOGGER.info("Initializing Project-HomeFlix build " + buildNumber); | ||||
| 		 | ||||
| 		main.loadSettings(); // load settings | ||||
| 		xmlController.loadSettings(); // load settings | ||||
| 		checkAutoUpdate(); | ||||
| 		 | ||||
| 		// initialize the GUI and the DBController | ||||
| @ -222,16 +217,16 @@ public class MainWindowController { | ||||
| 	// Initialize general UI elements | ||||
| 	private void initUI() { | ||||
| 		versionLbl.setText("Version: " + version + " (Build: " + buildNumber + ")"); | ||||
| 		fontsizeSlider.setValue(getFontSize()); | ||||
| 		colorPicker.setValue(Color.valueOf(getColor())); | ||||
| 		fontsizeSlider.setValue(XMLController.getFontSize()); | ||||
| 		colorPicker.setValue(Color.valueOf(XMLController.getColor())); | ||||
|  | ||||
| 		updateBtn.setFont(Font.font("System", 12)); | ||||
| 		autoUpdateToggleBtn.setSelected(isAutoUpdate()); | ||||
| 		autoplayToggleBtn.setSelected(isAutoplay()); | ||||
| 		autoUpdateToggleBtn.setSelected(XMLController.isAutoUpdate()); | ||||
| 		autoplayToggleBtn.setSelected(XMLController.isAutoplay()); | ||||
| 		languageChoisBox.setItems(languages); | ||||
| 		branchChoisBox.setItems(branches); | ||||
| 		 | ||||
| 		if (isUseBeta()) { | ||||
| 		if (XMLController.isUseBeta()) { | ||||
| 			branchChoisBox.getSelectionModel().select(1); | ||||
| 		} else { | ||||
| 			branchChoisBox.getSelectionModel().select(0); | ||||
| @ -303,7 +298,7 @@ public class MainWindowController { | ||||
| 			} | ||||
| 			if (settingsTrue) { | ||||
| 				settingsScrollPane.setVisible(false); | ||||
| 				main.saveSettings(); | ||||
| 				xmlController.saveSettings(); | ||||
| 				settingsTrue = false; | ||||
| 			} | ||||
| 		}); | ||||
| @ -313,9 +308,9 @@ public class MainWindowController { | ||||
| 			public void changed(ObservableValue<? extends Number> ov, Number value, Number new_value) { | ||||
| 				String local = languageChoisBox.getItems().get((int) new_value).toString(); | ||||
| 				local = local.substring(local.length() - 6, local.length() - 1); // reading only en_US from English (en_US) | ||||
| 				setLocal(local); | ||||
| 				XMLController.setUsrLocal(local); | ||||
| 				setLocalUI(); | ||||
| 				main.saveSettings(); | ||||
| 				xmlController.saveSettings(); | ||||
| 			} | ||||
| 		}); | ||||
|  | ||||
| @ -323,22 +318,22 @@ public class MainWindowController { | ||||
| 			@Override | ||||
| 			public void changed(ObservableValue<? extends Number> ov, Number value, Number new_value) { | ||||
| 				if (branchChoisBox.getItems().get((int) new_value).toString() == "beta") { | ||||
| 					setUseBeta(true); | ||||
| 					XMLController.setUseBeta(true); | ||||
| 				} else { | ||||
| 					setUseBeta(false); | ||||
| 					XMLController.setUseBeta(false); | ||||
| 				} | ||||
| 				main.saveSettings(); | ||||
| 				xmlController.saveSettings(); | ||||
| 			} | ||||
| 		}); | ||||
|          | ||||
| 		fontsizeSlider.valueProperty().addListener(new ChangeListener<Number>() { | ||||
| 			@Override | ||||
| 			public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) { | ||||
| 				setFontSize(fontsizeSlider.getValue()); | ||||
| 				XMLController.setFontSize(fontsizeSlider.getValue()); | ||||
| 				if (!getCurrentTitle().isEmpty()) { | ||||
| 					dbController.readCache(getCurrentStreamUrl()); | ||||
| 				} | ||||
| 				main.saveSettings(); | ||||
| 				xmlController.saveSettings(); | ||||
| 			} | ||||
| 		}); | ||||
|          | ||||
| @ -362,7 +357,7 @@ public class MainWindowController { | ||||
| 					filmRoot.getChildren().add(new TreeItem<FilmTabelDataType>(filterData.get(i))); // add filtered data to root node after search | ||||
| 				} | ||||
| 				if (searchTextField.getText().hashCode() == hashA) { | ||||
| 					setColor("000000"); | ||||
| 					XMLController.setColor("000000"); | ||||
| 					colorPicker.setValue(new Color(0, 0, 0, 1)); | ||||
| 					applyColor(); | ||||
| 				} | ||||
| @ -443,7 +438,7 @@ public class MainWindowController { | ||||
| 					LOGGER.info("loading from cache: " + getCurrentTitle()); | ||||
| 					dbController.readCache(getCurrentStreamUrl()); | ||||
| 				} else { | ||||
| 					Thread omdbAPIThread = new Thread(new OMDbAPIController(main, dbController, currentTableFilm, omdbAPIKey, true)); | ||||
| 					Thread omdbAPIThread = new Thread(new OMDbAPIController(dbController, currentTableFilm, XMLController.getOmdbAPIKey(), true)); | ||||
| 					omdbAPIThread.setName("OMDbAPI"); | ||||
| 					omdbAPIThread.start(); | ||||
| 				} | ||||
| @ -538,7 +533,7 @@ public class MainWindowController { | ||||
| 	private void settingsBtnclicked() { | ||||
| 		if (settingsTrue) { | ||||
| 			settingsScrollPane.setVisible(false); | ||||
| 			main.saveSettings(); | ||||
| 			xmlController.saveSettings(); | ||||
| 			settingsTrue = false; | ||||
| 		} else { | ||||
| 			settingsScrollPane.setVisible(true); | ||||
| @ -572,29 +567,29 @@ public class MainWindowController { | ||||
| 	 | ||||
| 	@FXML | ||||
| 	private void colorPickerAction() { | ||||
| 		setColor(colorPicker.getValue().toString().substring(2, 10)); | ||||
| 		main.saveSettings(); | ||||
| 		XMLController.setColor(colorPicker.getValue().toString().substring(2, 10)); | ||||
| 		xmlController.saveSettings(); | ||||
| 		applyColor(); | ||||
| 	} | ||||
| 	 | ||||
| 	@FXML | ||||
| 	private void updateBtnAction() { | ||||
| 		updateController = new UpdateController(this, buildNumber, useBeta); | ||||
| 		updateController = new UpdateController(this, buildNumber, XMLController.isUseBeta()); | ||||
| 		Thread updateThread = new Thread(updateController); | ||||
| 		updateThread.setName("Updater"); | ||||
| 		updateThread.start();	 | ||||
| 	} | ||||
| 	 | ||||
| 	@FXML | ||||
| 	private void autoUpdateToggleBtnAction(){ | ||||
| 		autoUpdate = isAutoUpdate() ? false : true; | ||||
| 		main.saveSettings(); | ||||
| 	private void autoUpdateToggleBtnAction() { | ||||
| 		XMLController.setAutoUpdate(!XMLController.isAutoUpdate()); | ||||
| 		xmlController.saveSettings(); | ||||
| 	} | ||||
| 	 | ||||
| 	@FXML | ||||
| 	private void autoplayToggleBtnAction(){ | ||||
| 		autoplay = isAutoplay() ? false : true; | ||||
| 		main.saveSettings(); | ||||
| 		XMLController.setAutoplay(!XMLController.isAutoplay()); | ||||
| 		xmlController.saveSettings(); | ||||
| 	} | ||||
| 	 | ||||
| 	// refresh the selected child of the root node | ||||
| @ -652,9 +647,9 @@ public class MainWindowController { | ||||
|  | ||||
| 		try { | ||||
| 			// read old array | ||||
| 			File oldSources = new File(main.getDirectory() + "/sources.json"); | ||||
| 			File oldSources = new File(XMLController.getDirHomeFlix() + "/sources.json"); | ||||
| 			if (oldSources.exists()) { | ||||
| 				newsources = Json.parse(new FileReader(main.getDirectory() + "/sources.json")).asArray(); | ||||
| 				newsources = Json.parse(new FileReader(XMLController.getDirHomeFlix() + "/sources.json")).asArray(); | ||||
| 			} else { | ||||
| 				newsources = Json.array(); | ||||
| 			} | ||||
| @ -662,7 +657,7 @@ public class MainWindowController { | ||||
| 			// add new source | ||||
| 			source = Json.object().add("path", path).add("mode", mode); | ||||
| 			newsources.add(source); | ||||
| 			Writer writer = new FileWriter(main.getDirectory() + "/sources.json"); | ||||
| 			Writer writer = new FileWriter(XMLController.getDirHomeFlix() + "/sources.json"); | ||||
| 			newsources.writeTo(writer); | ||||
| 			writer.close(); | ||||
| 		} catch (IOException e) { | ||||
| @ -682,11 +677,11 @@ public class MainWindowController { | ||||
| 	 */ | ||||
| 	private void applyColor() { | ||||
| 		String menuBtnStyle; | ||||
| 		BigInteger usedColor = new BigInteger(getColor(), 16); | ||||
| 		BigInteger usedColor = new BigInteger(XMLController.getColor(), 16); | ||||
| 		BigInteger checkColor = new BigInteger("78909cff", 16); | ||||
|  | ||||
| 		if (usedColor.compareTo(checkColor) == -1) { | ||||
| 			btnStyle = "-fx-button-type: RAISED; -fx-background-color: #" + getColor() + "; -fx-text-fill: WHITE;"; | ||||
| 			btnStyle = "-fx-button-type: RAISED; -fx-background-color: #" + XMLController.getColor() + "; -fx-text-fill: WHITE;"; | ||||
| 			menuBtnStyle = "-fx-text-fill: WHITE;"; | ||||
| 			 | ||||
| 			playbtn.setGraphic(new ImageView(new Image("icons/ic_play_arrow_white_18dp_1x.png"))); | ||||
| @ -696,7 +691,7 @@ public class MainWindowController { | ||||
| 			menuHam.getStyleClass().clear(); | ||||
| 			menuHam.getStyleClass().add("jfx-hamburgerW"); | ||||
| 		} else { | ||||
| 			btnStyle = "-fx-button-type: RAISED; -fx-background-color: #" + getColor() + "; -fx-text-fill: BLACK;"; | ||||
| 			btnStyle = "-fx-button-type: RAISED; -fx-background-color: #" + XMLController.getColor() + "; -fx-text-fill: BLACK;"; | ||||
| 			menuBtnStyle = "-fx-text-fill: BLACK;"; | ||||
| 			 | ||||
| 			playbtn.setGraphic(new ImageView(new Image("icons/ic_play_arrow_black_18dp_1x.png"))); | ||||
| @ -708,9 +703,9 @@ public class MainWindowController { | ||||
| 		} | ||||
| 		 | ||||
| 		// boxes and TextFields | ||||
| 		sideMenuVBox.setStyle("-fx-background-color: #" + getColor() + ";"); | ||||
| 		topHBox.setStyle("-fx-background-color: #" + getColor() + ";"); | ||||
| 		searchTextField.setFocusColor(Color.valueOf(getColor())); | ||||
| 		sideMenuVBox.setStyle("-fx-background-color: #" + XMLController.getColor() + ";"); | ||||
| 		topHBox.setStyle("-fx-background-color: #" + XMLController.getColor() + ";"); | ||||
| 		searchTextField.setFocusColor(Color.valueOf(XMLController.getColor())); | ||||
| 		 | ||||
| 		// normal buttons | ||||
| 		addDirectoryBtn.setStyle(btnStyle); | ||||
| @ -747,7 +742,7 @@ public class MainWindowController { | ||||
| 	 * set the local based on the languageChoisBox selection | ||||
| 	 */ | ||||
| 	void setLocalUI() { | ||||
| 		switch (getLocal()) { | ||||
| 		switch (XMLController.getUsrLocal()) { | ||||
| 		case "en_US": | ||||
| 			setBundle(ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US)); // us_English | ||||
| 			languageChoisBox.getSelectionModel().select(0); | ||||
| @ -785,10 +780,10 @@ public class MainWindowController { | ||||
| 	// if AutoUpdate, then check for updates | ||||
| 	private void checkAutoUpdate() { | ||||
|  | ||||
| 		if (isAutoUpdate()) { | ||||
| 		if (XMLController.isAutoUpdate()) { | ||||
| 			try { | ||||
| 				LOGGER.info("AutoUpdate: looking for updates on startup ..."); | ||||
| 				updateController = new UpdateController(this, buildNumber, useBeta); | ||||
| 				updateController = new UpdateController(this, buildNumber, XMLController.isUseBeta()); | ||||
| 				Thread updateThread = new Thread(updateController); | ||||
| 				updateThread.setName("Updater"); | ||||
| 				updateThread.start(); | ||||
| @ -824,7 +819,7 @@ public class MainWindowController { | ||||
| 		for (FilmTabelDataType entry : dbController.getAllNotCachedEntries()) { | ||||
| 			System.out.println(entry.getStreamUrl() + " is NOT cached!"); | ||||
| 			 | ||||
| 			Runnable OMDbAPIWorker = new OMDbAPIController(main, dbController, entry, omdbAPIKey, false); | ||||
| 			Runnable OMDbAPIWorker = new OMDbAPIController(dbController, entry, XMLController.getOmdbAPIKey(), false); | ||||
| 			executor.execute(OMDbAPIWorker); | ||||
| 		} | ||||
| 		executor.shutdown(); | ||||
| @ -836,14 +831,6 @@ public class MainWindowController { | ||||
| 	public DBController getDbController() { | ||||
| 		return dbController; | ||||
| 	} | ||||
|  | ||||
| 	public String getColor() { | ||||
| 		return color; | ||||
| 	} | ||||
| 	 | ||||
| 	public void setColor(String input) { | ||||
| 		this.color = input; | ||||
| 	} | ||||
| 	 | ||||
| 	public FilmTabelDataType getCurrentTableFilm() { | ||||
| 		return currentTableFilm; | ||||
| @ -857,14 +844,6 @@ public class MainWindowController { | ||||
| 		return currentTableFilm.getStreamUrl(); | ||||
| 	} | ||||
|  | ||||
| 	public Double getFontSize() { | ||||
| 		return fontSize; | ||||
| 	} | ||||
| 	 | ||||
| 	public void setFontSize(Double input) { | ||||
| 		this.fontSize = input; | ||||
| 	} | ||||
|  | ||||
| 	public int getIndexTable() { | ||||
| 		return indexTable; | ||||
| 	} | ||||
| @ -873,46 +852,6 @@ public class MainWindowController { | ||||
| 		return indexList; | ||||
| 	} | ||||
|  | ||||
| 	public boolean isAutoUpdate() { | ||||
| 		return autoUpdate; | ||||
| 	} | ||||
| 	 | ||||
| 	public void setAutoUpdate(boolean input) { | ||||
| 		this.autoUpdate = input; | ||||
| 	} | ||||
|  | ||||
| 	public boolean isUseBeta() { | ||||
| 		return useBeta; | ||||
| 	} | ||||
|  | ||||
| 	public void setUseBeta(boolean useBeta) { | ||||
| 		this.useBeta = useBeta; | ||||
| 	} | ||||
| 	 | ||||
| 	public boolean isAutoplay() { | ||||
| 		return autoplay; | ||||
| 	} | ||||
|  | ||||
| 	public void setAutoplay(boolean autoplay) { | ||||
| 		this.autoplay = autoplay; | ||||
| 	} | ||||
|  | ||||
| 	public String getLocal() { | ||||
| 		return local; | ||||
| 	} | ||||
| 	 | ||||
| 	public void setLocal(String input) { | ||||
| 		this.local = input; | ||||
| 	} | ||||
|  | ||||
| 	public String getOmdbAPIKey() { | ||||
| 		return omdbAPIKey; | ||||
| 	} | ||||
| 	 | ||||
| 	public void setOmdbAPIKey(String omdbAPIKey) { | ||||
| 		this.omdbAPIKey = omdbAPIKey; | ||||
| 	} | ||||
|  | ||||
| 	public ObservableList<FilmTabelDataType> getFilmsList() { | ||||
| 		return filmsList; | ||||
| 	} | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| /** | ||||
|  * Project-HomeFlix | ||||
|  *  | ||||
|  * Copyright 2016-2018  <@Seil0> | ||||
|  * Copyright 2016-2019  <@Seil0> | ||||
|  *  | ||||
|  * This program is free software; you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
| @ -44,7 +44,6 @@ import javafx.scene.image.ImageView; | ||||
| import javafx.scene.text.Font; | ||||
| import javafx.scene.text.FontWeight; | ||||
| import javafx.scene.text.Text; | ||||
| import kellerkinder.HomeFlix.application.Main; | ||||
| import kellerkinder.HomeFlix.application.MainWindowController; | ||||
| import kellerkinder.HomeFlix.datatypes.DatabaseDataType; | ||||
| import kellerkinder.HomeFlix.datatypes.FilmTabelDataType; | ||||
| @ -53,7 +52,6 @@ import kellerkinder.HomeFlix.datatypes.OMDbAPIResponseDataType; | ||||
| public class DBController { | ||||
| 	 | ||||
| 	private MainWindowController mainWindowController; | ||||
| 	private Main main; | ||||
| 	private String DB_PATH; | ||||
| 	private Image favorite_black = new Image("icons/ic_favorite_black_18dp_1x.png"); | ||||
| 	private Image favorite_border_black = new Image("icons/ic_favorite_border_black_18dp_1x.png"); | ||||
| @ -67,8 +65,7 @@ public class DBController { | ||||
| 	 * @param main					the Main object | ||||
| 	 * @param mainWindowController	the MainWindowController object | ||||
| 	 */ | ||||
| 	public DBController(Main main, MainWindowController mainWindowController) {	 | ||||
| 		this.main = main; | ||||
| 	public DBController(MainWindowController mainWindowController) {	 | ||||
| 		this.mainWindowController = mainWindowController; | ||||
| 	} | ||||
| 	 | ||||
| @ -91,7 +88,7 @@ public class DBController { | ||||
| 	 * AutoCommit is set to false to prevent some issues, so manual commit is active! | ||||
| 	 */ | ||||
| 	private void initDatabaseConnection() { | ||||
| 		DB_PATH = main.getDirectory() + "/Homeflix.db"; | ||||
| 		DB_PATH = XMLController.getDirHomeFlix() + "/Homeflix.db"; | ||||
| 		try { | ||||
| 			// create a database connection | ||||
| 			connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH); | ||||
| @ -146,7 +143,7 @@ public class DBController { | ||||
| 	 * load all sources | ||||
| 	 */ | ||||
| 	private void loadSources() { | ||||
| 		SourcesController sourcesController = new SourcesController(main, mainWindowController); | ||||
| 		SourcesController sourcesController = new SourcesController(mainWindowController); | ||||
| 		sourceStreams = sourcesController.loadSources(); | ||||
| 	} | ||||
| 	 | ||||
| @ -456,7 +453,7 @@ public class DBController { | ||||
| 			PreparedStatement ps = connection.prepareStatement("SELECT * FROM cache WHERE streamUrl = ?"); | ||||
| 			ps.setString(1, streamUrl); | ||||
| 			ResultSet rs = ps.executeQuery(); | ||||
| 			Font font = Font.font("System", FontWeight.BOLD, (int) Math.round(mainWindowController.getFontSize())); | ||||
| 			Font font = Font.font("System", FontWeight.BOLD, (int) Math.round(XMLController.getFontSize())); | ||||
| 			ObservableList<Node> textFlow = mainWindowController.getTextFlow().getChildren();	 | ||||
| 			ArrayList<Text> nameText = new ArrayList<Text>(); | ||||
| 			 | ||||
| @ -513,7 +510,7 @@ public class DBController { | ||||
| 			textFlow.addAll(nameText.get(18), new Text(rs.getString("BoxOffice") + "\n")); | ||||
| 			textFlow.addAll(nameText.get(19), new Text(rs.getString("Website") + "\n")); | ||||
| 			 | ||||
| 			mainWindowController.getTextFlow().setStyle("-fx-font-size : " + ((int) Math.round(mainWindowController.getFontSize()) + 1) + "px;"); | ||||
| 			mainWindowController.getTextFlow().setStyle("-fx-font-size : " + ((int) Math.round(XMLController.getFontSize()) + 1) + "px;"); | ||||
| 			 | ||||
| 			// add the image | ||||
| 			try { | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| /** | ||||
|  * Project-HomeFlix | ||||
|  *  | ||||
|  * Copyright 2018  <@Seil0> | ||||
|  * Copyright 2018-2019  <@Seil0> | ||||
|  *  | ||||
|  * This program is free software; you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
| @ -19,6 +19,7 @@ | ||||
|  * MA 02110-1301, USA. | ||||
|  *  | ||||
|  */ | ||||
|  | ||||
| package kellerkinder.HomeFlix.controller; | ||||
|  | ||||
| import java.awt.image.BufferedImage; | ||||
| @ -37,14 +38,12 @@ import com.eclipsesource.json.JsonObject; | ||||
| import com.eclipsesource.json.JsonValue; | ||||
|  | ||||
| import javafx.application.Platform; | ||||
| import kellerkinder.HomeFlix.application.Main; | ||||
| import kellerkinder.HomeFlix.application.MainWindowController; | ||||
| import kellerkinder.HomeFlix.datatypes.FilmTabelDataType; | ||||
| import kellerkinder.HomeFlix.datatypes.OMDbAPIResponseDataType; | ||||
|  | ||||
| public class OMDbAPIController implements Runnable { | ||||
| 	 | ||||
| 	private Main main; | ||||
| 	private DBController dbController; | ||||
| 	private FilmTabelDataType currentTableFilm; | ||||
| 	private String omdbAPIKey; | ||||
| @ -60,8 +59,7 @@ public class OMDbAPIController implements Runnable { | ||||
| 	 * @param currentTableFilm		the current film object | ||||
| 	 * @param omdbAPIKey			the omdbAPI key | ||||
| 	 */ | ||||
| 	public OMDbAPIController(Main main, DBController dbController, FilmTabelDataType currentTableFilm, String omdbAPIKey, boolean refresh) { | ||||
| 		this.main = main; | ||||
| 	public OMDbAPIController(DBController dbController, FilmTabelDataType currentTableFilm, String omdbAPIKey, boolean refresh) { | ||||
| 		this.dbController = dbController; | ||||
| 		this.currentTableFilm = currentTableFilm; | ||||
| 		this.omdbAPIKey = omdbAPIKey; | ||||
| @ -126,7 +124,7 @@ public class OMDbAPIController implements Runnable { | ||||
| 		try { | ||||
| 			BufferedImage originalImage = ImageIO.read(new URL(object.getString("Poster", ""))); | ||||
| 			// change path to where file is located | ||||
| 			omdbResponse.setPoster(main.getPosterCache() + "/" + omdbResponse.getTitle() + ".png"); | ||||
| 			omdbResponse.setPoster(XMLController.getPosterCache() + "/" + omdbResponse.getTitle() + ".png"); | ||||
| 			ImageIO.write(originalImage, "png", new File(omdbResponse.getPoster())); | ||||
| 			LOGGER.info("adding poster to cache: " + omdbResponse.getPoster()); | ||||
| 		} catch (Exception e) { | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| /** | ||||
|  * Project-HomeFlix | ||||
|  * | ||||
|  * Copyright 2016-2018  <@Seil0> | ||||
|  * Copyright 2016-2019  <@Seil0> | ||||
|  *  | ||||
|  * This program is free software; you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
| @ -37,19 +37,16 @@ import com.eclipsesource.json.JsonArray; | ||||
| import com.eclipsesource.json.JsonObject; | ||||
| import com.eclipsesource.json.JsonValue; | ||||
|  | ||||
| import kellerkinder.HomeFlix.application.Main; | ||||
| import kellerkinder.HomeFlix.application.MainWindowController; | ||||
| import kellerkinder.HomeFlix.datatypes.DatabaseDataType; | ||||
|  | ||||
| public class SourcesController { | ||||
| 	 | ||||
| 	private MainWindowController mainWindowController; | ||||
| 	private Main main; | ||||
| 	private List<DatabaseDataType> sourceStreams = new ArrayList<DatabaseDataType>(); | ||||
| 	private static final Logger LOGGER = LogManager.getLogger(SourcesController.class.getName()); | ||||
| 	 | ||||
| 	public SourcesController(Main main, MainWindowController mainWindowController) {	 | ||||
| 		this.main = main; | ||||
| 	public SourcesController(MainWindowController mainWindowController) {	 | ||||
| 		this.mainWindowController = mainWindowController; | ||||
| 	} | ||||
| 	 | ||||
| @ -60,7 +57,7 @@ public class SourcesController { | ||||
| 		 | ||||
| 		try { | ||||
| 			// create a JsonArray, containing all sources, add each source to the mwc, get all films from it | ||||
| 			JsonArray sources = Json.parse(new FileReader(main.getDirectory() + "/sources.json")).asArray(); | ||||
| 			JsonArray sources = Json.parse(new FileReader(XMLController.getDirHomeFlix() + "/sources.json")).asArray(); | ||||
| 			for (JsonValue source : sources) { | ||||
| 				String path = source.asObject().getString("path", ""); | ||||
| 				String mode = source.asObject().getString("mode", ""); | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| /** | ||||
|  * Project-HomeFlix | ||||
|  *  | ||||
|  * Copyright 2018  <@Seil0> | ||||
|  * Copyright 2018-2019  <@Seil0> | ||||
|  *  | ||||
|  * This program is free software; you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
| @ -18,6 +18,7 @@ | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||||
|  * MA 02110-1301, USA. | ||||
|  */ | ||||
|  | ||||
| package kellerkinder.HomeFlix.controller; | ||||
|  | ||||
| import java.io.BufferedReader; | ||||
|  | ||||
| @ -0,0 +1,294 @@ | ||||
| /** | ||||
|  * Project-HomeFlix | ||||
|  * | ||||
|  * Copyright 2016-2019  <@Seil0> | ||||
|  *  | ||||
|  * This program is free software; you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation; either version 3 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  *  | ||||
|  * This program is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  *  | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||||
|  * MA 02110-1301, USA. | ||||
|  *  | ||||
|  */ | ||||
|  | ||||
| package kellerkinder.HomeFlix.controller; | ||||
|  | ||||
| import java.io.BufferedReader; | ||||
| import java.io.File; | ||||
| import java.io.FileInputStream; | ||||
| import java.io.FileOutputStream; | ||||
| import java.io.IOException; | ||||
| import java.io.InputStream; | ||||
| import java.io.InputStreamReader; | ||||
| import java.io.OutputStream; | ||||
| import java.util.Properties; | ||||
|  | ||||
| import org.apache.logging.log4j.LogManager; | ||||
| import org.apache.logging.log4j.Logger; | ||||
|  | ||||
| import com.eclipsesource.json.Json; | ||||
| import com.eclipsesource.json.JsonObject; | ||||
|  | ||||
| public class XMLController { | ||||
| 	 | ||||
| 	private static String userHome = System.getProperty("user.home"); | ||||
| 	private static String userName = System.getProperty("user.name"); | ||||
| 	private static String osName = System.getProperty("os.name"); | ||||
| 	private static String osArch = System.getProperty("os.arch"); | ||||
| 	private static String osVers = System.getProperty("os.version"); | ||||
| 	private static String javaVers = System.getProperty("java.version"); | ||||
| 	private static String javaVend = System.getProperty("java.vendor"); | ||||
| 	private static String sysLocal = System.getProperty("user.language") + "_" + System.getProperty("user.country"); | ||||
| 	private static String dirHomeFlixPath; | ||||
| 	private static File dirHomeFlix; | ||||
| 	private static File configFile; | ||||
| 	private static File posterCache; | ||||
| 	 | ||||
| 	// user settings | ||||
| 	private static String color = "ee3523"; | ||||
| 	private static String usrLocal = sysLocal; | ||||
| 	private static boolean autoUpdate = false; | ||||
| 	private static boolean useBeta = false; | ||||
| 	private static boolean autoplay = false; | ||||
| 	private static double fontSize = 17; | ||||
| 	 | ||||
| 	// user settings | ||||
| 	private static String omdbAPIKey; | ||||
| 	 | ||||
| 	private static final Logger LOGGER = LogManager.getLogger(XMLController.class.getName()); | ||||
| 	private Properties props = new Properties(); | ||||
| 	 | ||||
| 	/** | ||||
| 	 * prepare the start up, this is the first thing call by main | ||||
| 	 */ | ||||
| 	public XMLController() { | ||||
| 		 | ||||
| 		if (osName.contains("Windows")) { | ||||
| 			dirHomeFlixPath = userHome + "/Documents/HomeFlix"; | ||||
| 		} else { | ||||
| 			dirHomeFlixPath = userHome + "/HomeFlix"; | ||||
| 		} | ||||
| 		 | ||||
| 		// set the concrete files | ||||
| 		dirHomeFlix = new File(dirHomeFlixPath); | ||||
| 		configFile = new File(dirHomeFlix + "/config.xml"); | ||||
| 		posterCache = new File(dirHomeFlix + "/posterCache"); | ||||
| 		 | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * save the configuration to the config.xml file | ||||
| 	 */ | ||||
| 	public void saveSettings() { | ||||
| 		LOGGER.info("saving settings ..."); | ||||
| 		try { | ||||
| 			props.setProperty("color", color); | ||||
| 			props.setProperty("autoUpdate", String.valueOf(autoUpdate)); | ||||
| 			props.setProperty("useBeta", String.valueOf(useBeta)); | ||||
| 			props.setProperty("autoplay", String.valueOf(autoplay)); | ||||
| 			props.setProperty("size", Double.toString(fontSize)); | ||||
| 			props.setProperty("local", usrLocal); | ||||
|  | ||||
| 			OutputStream outputStream = new FileOutputStream(getConfigFile()); // new output-stream | ||||
| 			props.storeToXML(outputStream, "Project HomeFlix settings"); // write new .xml | ||||
| 			outputStream.close(); | ||||
| 		} catch (IOException e) { | ||||
| 			LOGGER.error("An error occurred while saving the settings!", e); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * load the configuration from the config.xml file | ||||
| 	 * and try to load the API keys from apiKeys.json | ||||
| 	 */ | ||||
| 	public void loadSettings() { | ||||
| 		LOGGER.info("loading settings ..."); | ||||
| 		 | ||||
| 		try { | ||||
| 			InputStream inputStream = new FileInputStream(getConfigFile()); | ||||
| 			props.loadFromXML(inputStream); // new input-stream from .xml | ||||
|  | ||||
| 			try { | ||||
| 				setColor(props.getProperty("color")); | ||||
| 			} catch (Exception e) { | ||||
| 				LOGGER.error("cloud not load color", e); | ||||
| 				setColor("00a8cc"); | ||||
| 			} | ||||
|  | ||||
| 			try { | ||||
| 				setFontSize(Double.parseDouble(props.getProperty("size"))); | ||||
| 			} catch (Exception e) { | ||||
| 				LOGGER.error("cloud not load fontsize", e); | ||||
| 				setFontSize(17.0); | ||||
| 			} | ||||
|  | ||||
| 			try { | ||||
| 				setAutoUpdate(Boolean.parseBoolean(props.getProperty("autoUpdate"))); | ||||
| 			} catch (Exception e) { | ||||
| 				LOGGER.error("cloud not load autoUpdate", e); | ||||
| 				setAutoUpdate(false); | ||||
| 			} | ||||
| 			 | ||||
| 			try { | ||||
| 				setUseBeta(Boolean.parseBoolean(props.getProperty("useBeta"))); | ||||
| 			} catch (Exception e) { | ||||
| 				LOGGER.error("cloud not load autoUpdate", e); | ||||
| 				setUseBeta(false); | ||||
| 			} | ||||
| 			 | ||||
| 			try { | ||||
| 				setAutoplay(Boolean.parseBoolean(props.getProperty("autoplay"))); | ||||
| 			} catch (Exception e) { | ||||
| 				LOGGER.error("cloud not load autoplay", e); | ||||
| 				setAutoplay(false); | ||||
| 			} | ||||
|  | ||||
| 			try { | ||||
| 				setUsrLocal(props.getProperty("local")); | ||||
| 			} catch (Exception e) { | ||||
| 				LOGGER.error("cloud not load local", e); | ||||
| 				setUsrLocal(System.getProperty("user.language") + "_" + System.getProperty("user.country")); | ||||
| 			} | ||||
|  | ||||
| 			inputStream.close(); | ||||
| 		} catch (IOException e) { | ||||
| 			LOGGER.error("An error occurred while loading the settings!", e); | ||||
| 		} | ||||
| 		 | ||||
| 		// try loading the omdbAPI key | ||||
| 		try { | ||||
| 			InputStream in = getClass().getClassLoader().getResourceAsStream("apiKeys.json"); | ||||
| 			if (in != null) { | ||||
| 				BufferedReader reader = new BufferedReader(new InputStreamReader(in)); | ||||
| 				JsonObject apiKeys = Json.parse(reader).asObject(); | ||||
| 				setOmdbAPIKey(apiKeys.getString("omdbAPIKey", "")); | ||||
| 				reader.close(); | ||||
| 				in.close(); | ||||
| 			} else { | ||||
| 				LOGGER.warn("Cloud not load apiKeys.json. No such file"); | ||||
| 			} | ||||
| 		} catch (Exception e) { | ||||
| 			LOGGER.error("Cloud not load the omdbAPI key. Please contact the developer!", e); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	// getters for application variables | ||||
| 	 | ||||
| 	public static String getUserHome() { | ||||
| 		return userHome; | ||||
| 	} | ||||
|  | ||||
| 	public static String getUserName() { | ||||
| 		return userName; | ||||
| 	} | ||||
|  | ||||
| 	public static String getOsName() { | ||||
| 		return osName; | ||||
| 	} | ||||
|  | ||||
| 	public static String getOsArch() { | ||||
| 		return osArch; | ||||
| 	} | ||||
|  | ||||
| 	public static String getOsVers() { | ||||
| 		return osVers; | ||||
| 	} | ||||
|  | ||||
| 	public static String getJavaVers() { | ||||
| 		return javaVers; | ||||
| 	} | ||||
|  | ||||
| 	public static String getJavaVend() { | ||||
| 		return javaVend; | ||||
| 	} | ||||
|  | ||||
| 	public static String getSysLocal() { | ||||
| 		return sysLocal; | ||||
| 	} | ||||
| 	 | ||||
| 	public static String getDirHomeFlixPath() { | ||||
| 		return dirHomeFlixPath; | ||||
| 	} | ||||
|  | ||||
| 	 | ||||
| 	public static File getDirHomeFlix() { | ||||
| 		return dirHomeFlix; | ||||
| 	} | ||||
|  | ||||
| 	public static File getConfigFile() { | ||||
| 		return configFile; | ||||
| 	} | ||||
|  | ||||
| 	public static File getPosterCache() { | ||||
| 		return posterCache; | ||||
| 	} | ||||
| 	 | ||||
| 	// getters for user settings | ||||
|  | ||||
| 	public static String getColor() { | ||||
| 		return color; | ||||
| 	} | ||||
|  | ||||
| 	public static void setColor(String color) { | ||||
| 		XMLController.color = color; | ||||
| 	} | ||||
|  | ||||
| 	public static String getUsrLocal() { | ||||
| 		return usrLocal; | ||||
| 	} | ||||
|  | ||||
| 	public static void setUsrLocal(String usrLocal) { | ||||
| 		XMLController.usrLocal = usrLocal; | ||||
| 	} | ||||
|  | ||||
| 	public static boolean isAutoUpdate() { | ||||
| 		return autoUpdate; | ||||
| 	} | ||||
|  | ||||
| 	public static void setAutoUpdate(boolean autoUpdate) { | ||||
| 		XMLController.autoUpdate = autoUpdate; | ||||
| 	} | ||||
|  | ||||
| 	public static boolean isUseBeta() { | ||||
| 		return useBeta; | ||||
| 	} | ||||
|  | ||||
| 	public static void setUseBeta(boolean useBeta) { | ||||
| 		XMLController.useBeta = useBeta; | ||||
| 	} | ||||
|  | ||||
| 	public static boolean isAutoplay() { | ||||
| 		return autoplay; | ||||
| 	} | ||||
|  | ||||
| 	public static void setAutoplay(boolean autoplay) { | ||||
| 		XMLController.autoplay = autoplay; | ||||
| 	} | ||||
|  | ||||
| 	public static double getFontSize() { | ||||
| 		return fontSize; | ||||
| 	} | ||||
|  | ||||
| 	public static void setFontSize(double fontSize) { | ||||
| 		XMLController.fontSize = fontSize; | ||||
| 	} | ||||
|  | ||||
| 	// getters for APIs | ||||
| 	 | ||||
| 	public static String getOmdbAPIKey() { | ||||
| 		return omdbAPIKey; | ||||
| 	} | ||||
|  | ||||
| 	private static void setOmdbAPIKey(String omdbAPIKey) { | ||||
| 		XMLController.omdbAPIKey = omdbAPIKey; | ||||
| 	} | ||||
| } | ||||
| @ -1,7 +1,7 @@ | ||||
| /** | ||||
|  * Project-HomeFlix | ||||
|  * | ||||
|  * Copyright 2016-2018  <@Seil0> | ||||
|  * Copyright 2016-2019  <@Seil0> | ||||
|  *  | ||||
|  * This program is free software; you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| /** | ||||
|  * Project-HomeFlix | ||||
|  *  | ||||
|  * Copyright 2016-2018  <@Seil0> | ||||
|  * Copyright 2016-2019  <@Seil0> | ||||
|  *  | ||||
|  * This program is free software; you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| /** | ||||
|  * Project-HomeFlix | ||||
|  *  | ||||
|  * Copyright 2018  <@Seil0> | ||||
|  * Copyright 2018-2019  <@Seil0> | ||||
|  *  | ||||
|  * This program is free software; you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
| @ -19,6 +19,7 @@ | ||||
|  * MA 02110-1301, USA. | ||||
|  *  | ||||
|  */ | ||||
|  | ||||
| package kellerkinder.HomeFlix.datatypes; | ||||
|  | ||||
| public class OMDbAPIResponseDataType { | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| /** | ||||
|  * Project-HomeFlix | ||||
|  *  | ||||
|  * Copyright 2016-2018  <@Seil0> | ||||
|  * Copyright 2016-2019  <@Seil0> | ||||
|  *  | ||||
|  * This program is free software; you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| /** | ||||
|  * Project-HomeFlix | ||||
|  * | ||||
|  * Copyright 2016-2018  <@Seil0> | ||||
|  * Copyright 2016-2019  <@Seil0> | ||||
|  *  | ||||
|  * This program is free software; you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
| @ -19,6 +19,7 @@ | ||||
|  * MA 02110-1301, USA. | ||||
|  *  | ||||
|  */ | ||||
|  | ||||
| package kellerkinder.HomeFlix.player; | ||||
|  | ||||
| import javafx.event.EventHandler; | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| /** | ||||
|  * Project-HomeFlix | ||||
|  * | ||||
|  * Copyright 2016-2018  <@Seil0> | ||||
|  * Copyright 2016-2019  <@Seil0> | ||||
|  *  | ||||
|  * This program is free software; you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
| @ -48,6 +48,7 @@ import javafx.scene.media.MediaPlayer.Status; | ||||
| import javafx.scene.media.MediaView; | ||||
| import javafx.util.Duration; | ||||
| import kellerkinder.HomeFlix.application.MainWindowController; | ||||
| import kellerkinder.HomeFlix.controller.XMLController; | ||||
| import kellerkinder.HomeFlix.datatypes.FilmTabelDataType; | ||||
|  | ||||
| public class PlayerController { | ||||
| @ -124,7 +125,7 @@ public class PlayerController { | ||||
| 		height.bind(Bindings.selectDouble(mediaView.sceneProperty(), "height")); | ||||
|  | ||||
| 		startTime = mainWCon.getDbController().getCurrentTime(film.getStreamUrl()); | ||||
| 		autoplay = mainWCon.isAutoplay(); | ||||
| 		autoplay = XMLController.isAutoplay(); | ||||
| 		season = !film.getSeason().isEmpty() ? Integer.parseInt(film.getSeason()) : 0; | ||||
| 		episode = !film.getEpisode().isEmpty() ? Integer.parseInt(film.getEpisode()) : 0; | ||||
| 		 | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| /** | ||||
|  * Kellerkinder Framework Alerts | ||||
|  *  | ||||
|  * Copyright 2018  <@Seil0> | ||||
|  * Copyright 2018-2019  <@Seil0> | ||||
|  *  | ||||
|  * This program is free software; you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
| @ -18,6 +18,7 @@ | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||||
|  * MA 02110-1301, USA. | ||||
|  */ | ||||
|  | ||||
| package org.kellerkinder.Alerts; | ||||
|  | ||||
| import com.jfoenix.controls.JFXAlert; | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| /** | ||||
|  * Kellerkinder Framework Alerts | ||||
|  *  | ||||
|  * Copyright 2018  <@Seil0> | ||||
|  * Copyright 2018-2019  <@Seil0> | ||||
|  *  | ||||
|  * This program is free software; you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
| @ -18,6 +18,7 @@ | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||||
|  * MA 02110-1301, USA. | ||||
|  */ | ||||
|  | ||||
| package org.kellerkinder.Alerts; | ||||
|  | ||||
| import com.jfoenix.controls.JFXAlert; | ||||
|  | ||||
| @ -32,7 +32,7 @@ columnFavorite = Favorit | ||||
|  | ||||
| #error translations | ||||
| vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt! | ||||
| infoText = \nAutoren: \n \u2022 seil0@mosad.xyz \n \u2022 localhorst@mosad.xyz \n(c) 2016-2018 mosad www.mosad.xyz | ||||
| infoText = \nAutoren: \n \u2022 seil0@mosad.xyz \n \u2022 localhorst@mosad.xyz \n(c) 2016-2019 mosad www.mosad.xyz | ||||
|  | ||||
| #textFlow translations | ||||
| title = Titel | ||||
|  | ||||
| @ -32,7 +32,7 @@ columnFavorite = Favorite | ||||
|  | ||||
| #error translations | ||||
| vlcNotInstalled = VLC Media Player is required to play a movie! | ||||
| infoText = \nMaintainers: \n \u2022 seil0@mosad.xyz \n \u2022 localhorst@mosad.xyz \n(c) 2016-2018 mosad www.mosad.xyz | ||||
| infoText = \nMaintainers: \n \u2022 seil0@mosad.xyz \n \u2022 localhorst@mosad.xyz \n(c) 2016-2019 mosad www.mosad.xyz | ||||
|  | ||||
| #textFlow translations | ||||
| title = Title | ||||
|  | ||||
		Reference in New Issue
	
	Block a user