release 0.8.0 #12
|
@ -101,7 +101,6 @@ public class Main extends Application {
|
||||||
XMLController.getPosterCache().mkdir();
|
XMLController.getPosterCache().mkdir();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.error(e);
|
LOGGER.error(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,12 +32,13 @@ import java.io.InputStreamReader;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.kellerkinder.Alerts.JFXInfoAlert;
|
import org.kellerkinder.Alerts.JFXInfoAlert;
|
||||||
|
@ -93,9 +94,9 @@ import kellerkinder.HomeFlix.controller.DBController;
|
||||||
import kellerkinder.HomeFlix.controller.OMDbAPIController;
|
import kellerkinder.HomeFlix.controller.OMDbAPIController;
|
||||||
import kellerkinder.HomeFlix.controller.UpdateController;
|
import kellerkinder.HomeFlix.controller.UpdateController;
|
||||||
import kellerkinder.HomeFlix.controller.XMLController;
|
import kellerkinder.HomeFlix.controller.XMLController;
|
||||||
|
import kellerkinder.HomeFlix.datatypes.FilmTabelDataType;
|
||||||
import kellerkinder.HomeFlix.datatypes.SourceDataType;
|
import kellerkinder.HomeFlix.datatypes.SourceDataType;
|
||||||
import kellerkinder.HomeFlix.player.Player;
|
import kellerkinder.HomeFlix.player.Player;
|
||||||
import kellerkinder.HomeFlix.datatypes.FilmTabelDataType;
|
|
||||||
|
|
||||||
public class MainWindowController {
|
public class MainWindowController {
|
||||||
|
|
||||||
|
@ -163,14 +164,13 @@ public class MainWindowController {
|
||||||
// poster-mode
|
// poster-mode
|
||||||
// @FXML private AnchorPane posterModeAnchorPane;
|
// @FXML private AnchorPane posterModeAnchorPane;
|
||||||
|
|
||||||
private static DBController dbController; // the player needs the initialized dbController
|
private DBController dbController;
|
||||||
private UpdateController updateController;
|
private UpdateController updateController;
|
||||||
private XMLController xmlController;
|
private XMLController xmlController;
|
||||||
private Stage primaryStage;
|
private Stage primaryStage;
|
||||||
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
|
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
|
||||||
|
|
||||||
private boolean menuTrue = false;
|
private boolean menuTrue = false;
|
||||||
private boolean settingsTrue = false;
|
|
||||||
|
|
||||||
private final String version = "0.7.0";
|
private final String version = "0.7.0";
|
||||||
private final String buildNumber = "169";
|
private final String buildNumber = "169";
|
||||||
|
@ -290,9 +290,8 @@ public class MainWindowController {
|
||||||
burgerTask.play();
|
burgerTask.play();
|
||||||
menuTrue = true;
|
menuTrue = true;
|
||||||
}
|
}
|
||||||
if (settingsTrue) {
|
if (settingsScrollPane.isVisible()) {
|
||||||
settingsScrollPane.setVisible(false);
|
settingsScrollPane.setVisible(false);
|
||||||
settingsTrue = false;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -512,10 +511,11 @@ public class MainWindowController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void openfolderbtnclicked() {
|
private void openfolderbtnclicked() {
|
||||||
String dest = new File(getCurrentStreamUrl()).getParentFile().getAbsolutePath();
|
File dest = new File(getCurrentStreamUrl()).getParentFile();
|
||||||
|
|
||||||
if (!System.getProperty("os.name").contains("Linux")) {
|
if (!System.getProperty("os.name").contains("Linux")) {
|
||||||
try {
|
try {
|
||||||
Desktop.getDesktop().open(new File(dest));
|
Desktop.getDesktop().open(dest);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -543,12 +543,10 @@ public class MainWindowController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void settingsBtnclicked() {
|
private void settingsBtnclicked() {
|
||||||
if (settingsTrue) {
|
if (settingsScrollPane.isVisible()) {
|
||||||
settingsScrollPane.setVisible(false);
|
settingsScrollPane.setVisible(false);
|
||||||
settingsTrue = false;
|
|
||||||
} else {
|
} else {
|
||||||
settingsScrollPane.setVisible(true);
|
settingsScrollPane.setVisible(true);
|
||||||
settingsTrue = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,8 +611,8 @@ public class MainWindowController {
|
||||||
* clear the FilmsList and FilmRoot children, then update the database
|
* clear the FilmsList and FilmRoot children, then update the database
|
||||||
*/
|
*/
|
||||||
private void refreshAllFilms() {
|
private void refreshAllFilms() {
|
||||||
getFilmsList().clear();
|
filmsList.clear();
|
||||||
getFilmRoot().getChildren().clear();
|
filmRoot.getChildren().clear();
|
||||||
dbController.refreshDataBase(); // refreshes the database after a source path was added
|
dbController.refreshDataBase(); // refreshes the database after a source path was added
|
||||||
filmsList = dbController.getDatabaseFilmsList(); // returns a list of all films stored in the database
|
filmsList = dbController.getDatabaseFilmsList(); // returns a list of all films stored in the database
|
||||||
addFilmsToTable(filmsList);
|
addFilmsToTable(filmsList);
|
||||||
|
@ -690,7 +688,7 @@ public class MainWindowController {
|
||||||
|
|
||||||
// clear old sources list/table
|
// clear old sources list/table
|
||||||
getSourcesList().clear();
|
getSourcesList().clear();
|
||||||
getSourceRoot().getChildren().clear();
|
sourceRoot.getChildren().clear();
|
||||||
|
|
||||||
// clear the FilmsList and FilmRoot children, then update the database
|
// clear the FilmsList and FilmRoot children, then update the database
|
||||||
refreshAllFilms();
|
refreshAllFilms();
|
||||||
|
@ -809,27 +807,27 @@ public class MainWindowController {
|
||||||
ObservableList<Node> textFlow = getTextFlow().getChildren();
|
ObservableList<Node> textFlow = getTextFlow().getChildren();
|
||||||
|
|
||||||
// TODO this should move! ***
|
// TODO this should move! ***
|
||||||
ArrayList<Text> nameText = new ArrayList<Text>();
|
Text[] nameText = new Text[20];
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("title") + ": "));
|
nameText[0] = new Text(XMLController.getLocalBundle().getString("title") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("year") + ": "));
|
nameText[1] = new Text(XMLController.getLocalBundle().getString("year") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("rated") + ": "));
|
nameText[2] = new Text(XMLController.getLocalBundle().getString("rated") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("released") + ": "));
|
nameText[3] = new Text(XMLController.getLocalBundle().getString("released") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("season") + ": "));
|
nameText[4] = new Text(XMLController.getLocalBundle().getString("season") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("episode") + ": "));
|
nameText[5] = new Text(XMLController.getLocalBundle().getString("episode") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("runtime") + ": "));
|
nameText[6] = new Text(XMLController.getLocalBundle().getString("runtime") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("genre") + ": "));
|
nameText[7] = new Text(XMLController.getLocalBundle().getString("genre") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("director") + ": "));
|
nameText[8] = new Text(XMLController.getLocalBundle().getString("director") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("writer") + ": "));
|
nameText[9] = new Text(XMLController.getLocalBundle().getString("writer") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("actors") + ": "));
|
nameText[10] = new Text(XMLController.getLocalBundle().getString("actors") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("plot") + ": "));
|
nameText[11] = new Text(XMLController.getLocalBundle().getString("plot") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("language") + ": "));
|
nameText[12] = new Text(XMLController.getLocalBundle().getString("language") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("country") + ": "));
|
nameText[13] = new Text(XMLController.getLocalBundle().getString("country") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("awards") + ": "));
|
nameText[14] = new Text(XMLController.getLocalBundle().getString("awards") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("metascore") + ": "));
|
nameText[15] = new Text(XMLController.getLocalBundle().getString("metascore") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("imdbRating") + ": "));
|
nameText[16] = new Text(XMLController.getLocalBundle().getString("imdbRating") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("type") + ": "));
|
nameText[17] = new Text(XMLController.getLocalBundle().getString("type") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("boxOffice") + ": "));
|
nameText[18] = new Text(XMLController.getLocalBundle().getString("boxOffice") + ": ");
|
||||||
nameText.add(new Text(XMLController.getLocalBundle().getString("website") + ": "));
|
nameText[19] = new Text(XMLController.getLocalBundle().getString("website") + ": ");
|
||||||
// ***
|
// ***
|
||||||
|
|
||||||
// set the correct font for the nameText
|
// set the correct font for the nameText
|
||||||
|
@ -845,7 +843,7 @@ public class MainWindowController {
|
||||||
if (cacheData[i] != null && (i == 5 || i == 6) && cacheData[5].length() == 0) {
|
if (cacheData[i] != null && (i == 5 || i == 6) && cacheData[5].length() == 0) {
|
||||||
// do nothing
|
// do nothing
|
||||||
} else if(cacheData[i] != null){
|
} else if(cacheData[i] != null){
|
||||||
textFlow.addAll(nameText.get(i), new Text(cacheData[i] + "\n"));
|
textFlow.addAll(nameText[i], new Text(cacheData[i] + "\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -853,9 +851,9 @@ public class MainWindowController {
|
||||||
|
|
||||||
// add the image
|
// add the image
|
||||||
try {
|
try {
|
||||||
getPosterImageView().setImage(new Image(new File(cacheData[20]).toURI().toString()));
|
posterImageView.setImage(new Image(new File(cacheData[20]).toURI().toString()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
getPosterImageView().setImage(new Image("icons/close_black_2048x2048.png"));
|
posterImageView.setImage(new Image("icons/close_black_2048x2048.png"));
|
||||||
LOGGER.error("No Poster found, useing default.");
|
LOGGER.error("No Poster found, useing default.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -914,9 +912,6 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
|
|
||||||
// getter and setter
|
// getter and setter
|
||||||
public static DBController getDbController() {
|
|
||||||
return dbController;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FilmTabelDataType getCurrentTableFilm() {
|
public FilmTabelDataType getCurrentTableFilm() {
|
||||||
return currentTableFilm;
|
return currentTableFilm;
|
||||||
|
@ -938,35 +933,15 @@ public class MainWindowController {
|
||||||
return indexList;
|
return indexList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObservableList<FilmTabelDataType> getFilmsList() {
|
|
||||||
return filmsList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ObservableList<SourceDataType> getSourcesList() {
|
public static ObservableList<SourceDataType> getSourcesList() {
|
||||||
return sourcesList;
|
return sourcesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TreeTableView<FilmTabelDataType> getFilmsTreeTable() {
|
|
||||||
return filmsTreeTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TextFlow getTextFlow() {
|
public TextFlow getTextFlow() {
|
||||||
return textFlow;
|
return textFlow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageView getPosterImageView() {
|
|
||||||
return posterImageView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JFXButton getUpdateBtn() {
|
public JFXButton getUpdateBtn() {
|
||||||
return updateBtn;
|
return updateBtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TreeItem<FilmTabelDataType> getFilmRoot() {
|
|
||||||
return filmRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TreeItem<SourceDataType> getSourceRoot() {
|
|
||||||
return sourceRoot;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class SourcesController {
|
||||||
for (JsonValue source : sources) {
|
for (JsonValue source : sources) {
|
||||||
String path = source.asObject().getString("path", "");
|
String path = source.asObject().getString("path", "");
|
||||||
String mode = source.asObject().getString("mode", "");
|
String mode = source.asObject().getString("mode", "");
|
||||||
MainWindowController.getSourcesList().add(new SourceDataType(path, mode));
|
MainWindowController.getSourcesList().add(new SourceDataType(path, mode)); // TODO
|
||||||
|
|
||||||
if (mode.equals("local"))
|
if (mode.equals("local"))
|
||||||
addLocalSource(path);
|
addLocalSource(path);
|
||||||
|
|
|
@ -30,7 +30,7 @@ import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.stage.WindowEvent;
|
import javafx.stage.WindowEvent;
|
||||||
import kellerkinder.HomeFlix.application.Main;
|
import kellerkinder.HomeFlix.application.Main;
|
||||||
import kellerkinder.HomeFlix.application.MainWindowController;
|
import kellerkinder.HomeFlix.controller.DBController;
|
||||||
import kellerkinder.HomeFlix.datatypes.FilmTabelDataType;
|
import kellerkinder.HomeFlix.datatypes.FilmTabelDataType;
|
||||||
|
|
||||||
public class Player {
|
public class Player {
|
||||||
|
@ -59,7 +59,7 @@ public class Player {
|
||||||
stage.getIcons().add(new Image(Main.class.getResourceAsStream("/icons/Homeflix_Icon_64x64.png")));
|
stage.getIcons().add(new Image(Main.class.getResourceAsStream("/icons/Homeflix_Icon_64x64.png")));
|
||||||
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
|
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
|
||||||
public void handle(WindowEvent we) {
|
public void handle(WindowEvent we) {
|
||||||
MainWindowController.getDbController().setCurrentTime(currentTableFilm.getStreamUrl(),
|
DBController.getInstance().setCurrentTime(currentTableFilm.getStreamUrl(),
|
||||||
playerController.getCurrentTime());
|
playerController.getCurrentTime());
|
||||||
playerController.getMediaPlayer().stop();
|
playerController.getMediaPlayer().stop();
|
||||||
stage.close();
|
stage.close();
|
||||||
|
|
|
@ -47,7 +47,7 @@ import javafx.scene.media.MediaPlayer;
|
||||||
import javafx.scene.media.MediaPlayer.Status;
|
import javafx.scene.media.MediaPlayer.Status;
|
||||||
import javafx.scene.media.MediaView;
|
import javafx.scene.media.MediaView;
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
import kellerkinder.HomeFlix.application.MainWindowController;
|
import kellerkinder.HomeFlix.controller.DBController;
|
||||||
import kellerkinder.HomeFlix.controller.XMLController;
|
import kellerkinder.HomeFlix.controller.XMLController;
|
||||||
import kellerkinder.HomeFlix.datatypes.FilmTabelDataType;
|
import kellerkinder.HomeFlix.datatypes.FilmTabelDataType;
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ public class PlayerController {
|
||||||
width.bind(Bindings.selectDouble(mediaView.sceneProperty(), "width"));
|
width.bind(Bindings.selectDouble(mediaView.sceneProperty(), "width"));
|
||||||
height.bind(Bindings.selectDouble(mediaView.sceneProperty(), "height"));
|
height.bind(Bindings.selectDouble(mediaView.sceneProperty(), "height"));
|
||||||
|
|
||||||
startTime = MainWindowController.getDbController().getCurrentTime(film.getStreamUrl());
|
startTime = DBController.getInstance().getCurrentTime(film.getStreamUrl());
|
||||||
autoplay = XMLController.isAutoplay();
|
autoplay = XMLController.isAutoplay();
|
||||||
season = !film.getSeason().isEmpty() ? Integer.parseInt(film.getSeason()) : 0;
|
season = !film.getSeason().isEmpty() ? Integer.parseInt(film.getSeason()) : 0;
|
||||||
episode = !film.getEpisode().isEmpty() ? Integer.parseInt(film.getEpisode()) : 0;
|
episode = !film.getEpisode().isEmpty() ? Integer.parseInt(film.getEpisode()) : 0;
|
||||||
|
@ -175,7 +175,7 @@ public class PlayerController {
|
||||||
} else if (timeToEnd < 120) {
|
} else if (timeToEnd < 120) {
|
||||||
// if we are 120ms to the end stop the media
|
// if we are 120ms to the end stop the media
|
||||||
mediaPlayer.stop();
|
mediaPlayer.stop();
|
||||||
MainWindowController.getDbController().setCurrentTime(film.getStreamUrl(), 0); // reset old video start time
|
DBController.getInstance().setCurrentTime(film.getStreamUrl(), 0); // reset old video start time
|
||||||
playBtn.setGraphic(play_arrow_black);
|
playBtn.setGraphic(play_arrow_black);
|
||||||
} else {
|
} else {
|
||||||
if (nextEpBtn.isVisible())
|
if (nextEpBtn.isVisible())
|
||||||
|
@ -253,7 +253,7 @@ public class PlayerController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
void stopBtnAction(ActionEvent event) {
|
void stopBtnAction(ActionEvent event) {
|
||||||
MainWindowController.getDbController().setCurrentTime(film.getStreamUrl(), currentTime);
|
DBController.getInstance().setCurrentTime(film.getStreamUrl(), currentTime);
|
||||||
mediaPlayer.stop();
|
mediaPlayer.stop();
|
||||||
player.getStage().close();
|
player.getStage().close();
|
||||||
}
|
}
|
||||||
|
@ -287,8 +287,8 @@ public class PlayerController {
|
||||||
|
|
||||||
private void autoPlayNewFilm() {
|
private void autoPlayNewFilm() {
|
||||||
autoplay = false;
|
autoplay = false;
|
||||||
MainWindowController.getDbController().setCurrentTime(film.getStreamUrl(), 0); // reset old video start time
|
DBController.getInstance().setCurrentTime(film.getStreamUrl(), 0); // reset old video start time
|
||||||
FilmTabelDataType nextFilm = MainWindowController.getDbController().getNextEpisode(film.getTitle(), episode, season);
|
FilmTabelDataType nextFilm = DBController.getInstance().getNextEpisode(film.getTitle(), episode, season);
|
||||||
if (nextFilm != null) {
|
if (nextFilm != null) {
|
||||||
mediaPlayer.stop();
|
mediaPlayer.stop();
|
||||||
film = nextFilm;
|
film = nextFilm;
|
||||||
|
|
Loading…
Reference in New Issue