From 965c081d0540c7f2473127c6f8c1bd5f000e385f Mon Sep 17 00:00:00 2001 From: Seil0 Date: Sat, 18 Apr 2020 13:19:24 +0200 Subject: [PATCH] replace stop button with back button, show media title * show next episode 30 sec before end * translate next episode btn --- .../HomeFlix/player/PlayerController.java | 41 +++++++++--------- src/main/resources/fxml/PlayerWindow.fxml | 15 +++---- ...baseline_keyboard_backspace_white_48dp.png | Bin 0 -> 159 bytes .../icons/baseline_stop_black_48dp.png | Bin 107 -> 0 bytes .../locals/HomeFlix-Local_de_DE.properties | 39 +++++++++++++---- .../locals/HomeFlix-Local_en_US.properties | 39 +++++++++++++---- 6 files changed, 88 insertions(+), 46 deletions(-) create mode 100644 src/main/resources/icons/baseline_keyboard_backspace_white_48dp.png delete mode 100755 src/main/resources/icons/baseline_stop_black_48dp.png diff --git a/src/main/java/kellerkinder/HomeFlix/player/PlayerController.java b/src/main/java/kellerkinder/HomeFlix/player/PlayerController.java index 92c506d..16a6871 100644 --- a/src/main/java/kellerkinder/HomeFlix/player/PlayerController.java +++ b/src/main/java/kellerkinder/HomeFlix/player/PlayerController.java @@ -72,7 +72,7 @@ public class PlayerController { @FXML private JFXSlider timeSlider; - @FXML private JFXButton stopBtn; + @FXML private JFXButton btnBack; @FXML private JFXButton playBtn; @FXML private JFXButton fullscreenBtn; @FXML private JFXButton nextEpBtn; @@ -90,7 +90,7 @@ public class PlayerController { private WritableImage videoImage; private PixelBuffer videoPixelBuffer; - private FilmTabelDataType film; + private FilmTabelDataType media; private long startTime = 0; private long currentTime = 0; private long endTime = 0; @@ -115,7 +115,7 @@ public class PlayerController { */ public PlayerController(Player player, String mediaURL) { this.player = player; - this.film = DBController.getInstance().getStream(mediaURL); + this.media = DBController.getInstance().getStream(mediaURL); mediaPlayerFactory = new MediaPlayerFactory(); embeddedMediaPlayer = mediaPlayerFactory.mediaPlayers().newEmbeddedMediaPlayer(); @@ -129,12 +129,12 @@ public class PlayerController { videoImageView.fitHeightProperty().bind(player.getStage().heightProperty()); // set needed variables - startTime = (long) DBController.getInstance().getCurrentTime(film.getStreamUrl()); + startTime = (long) DBController.getInstance().getCurrentTime(media.getStreamUrl()); autoplay = XMLController.isAutoplay(); - season = !film.getSeason().isEmpty() ? Integer.parseInt(film.getSeason()) : 0; - episode = !film.getEpisode().isEmpty() ? Integer.parseInt(film.getEpisode()) : 0; + season = !media.getSeason().isEmpty() ? Integer.parseInt(media.getSeason()) : 0; + episode = !media.getEpisode().isEmpty() ? Integer.parseInt(media.getEpisode()) : 0; - lblTitle.setText(film.getTitle()); + lblTitle.setText(media.getTitle()); initPlayerWindow(); initMediaPlayer(); @@ -235,12 +235,12 @@ public class PlayerController { } public void start() { - embeddedMediaPlayer.media().play(film.getStreamUrl()); + embeddedMediaPlayer.media().play(media.getStreamUrl()); embeddedMediaPlayer.controls().skipTime((long) startTime); // skipt to the start time } public void stop() { - DBController.getInstance().setCurrentTime(film.getStreamUrl(), embeddedMediaPlayer.status().time()); + DBController.getInstance().setCurrentTime(media.getStreamUrl(), embeddedMediaPlayer.status().time()); embeddedMediaPlayer.controls().stop(); embeddedMediaPlayer.release(); mediaPlayerFactory.release(); @@ -262,16 +262,17 @@ public class PlayerController { TimeUnit.MILLISECONDS.toSeconds(endTime) % 60)); - // show the next episode button 20 seconds before the end of a episode - if (endTime < 21000 && episode != 0 && autoplay) { - int countdown = (int) ((endTime / 1000) - 10); // a 10 seconds countdown + // show the next episode button 30 seconds before the end of a episode + if (endTime < 31000 && episode != 0 && autoplay) { + int countdown = (int) ((endTime / 1000) - 20); // a 10 seconds countdown if (!nextEpBtn.isVisible()) { nextEpBtn.setVisible(true); } - if (endTime > 10000) { - nextEpBtn.setText("next episode in " + countdown + " seconds"); // TODO translate + if (endTime > 20000) { + nextEpBtn.setText(XMLController.getLocalBundle().getString("nextEpisode") + + countdown + XMLController.getLocalBundle().getString("seconds")); bottomVBox.setVisible(true); System.out.println("next episode in " + countdown + " seconds"); } else { @@ -281,9 +282,9 @@ public class PlayerController { } } } - + @FXML - void stopBtnAction(ActionEvent event) { + void btnBackAction(ActionEvent event) { stop(); player.getStage().close(); } @@ -317,11 +318,11 @@ public class PlayerController { private void playNextMedia() { autoplay = false; - DBController.getInstance().setCurrentTime(film.getStreamUrl(), 0); // reset old video start time - FilmTabelDataType nextFilm = DBController.getInstance().getNextEpisode(film.getTitle(), episode, season); - if (nextFilm != null) { + DBController.getInstance().setCurrentTime(media.getStreamUrl(), 0); // reset old video start time + FilmTabelDataType nextMedia = DBController.getInstance().getNextEpisode(media.getTitle(), episode, season); + if (nextMedia != null) { //mediaPlayer2.stop(); - film = nextFilm; + media = nextMedia; autoplay = true; } } diff --git a/src/main/resources/fxml/PlayerWindow.fxml b/src/main/resources/fxml/PlayerWindow.fxml index 662d461..87eec1a 100644 --- a/src/main/resources/fxml/PlayerWindow.fxml +++ b/src/main/resources/fxml/PlayerWindow.fxml @@ -22,9 +22,12 @@ - + - + + + + - - - - - - - - diff --git a/src/main/resources/icons/baseline_keyboard_backspace_white_48dp.png b/src/main/resources/icons/baseline_keyboard_backspace_white_48dp.png new file mode 100644 index 0000000000000000000000000000000000000000..92280251bc35b1ff614e37899ced91498a4e7ede GIT binary patch literal 159 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpUtG*1`DkP61P=NUO090XV|_9k=u z=HQ4CNtQampv=(C=y!zwv(T9-&palnFfvP={Ftk9e7mjXKc=w9^2em}_k6TB6r68e zz{2yyC!{*_5z92L3FZ%5g#9cwhH}r5xOz!#U;lI!&r7^|DGc@E=a0Mx+Q{JP>gTe~ HDWM4f2pKc? literal 0 HcmV?d00001 diff --git a/src/main/resources/icons/baseline_stop_black_48dp.png b/src/main/resources/icons/baseline_stop_black_48dp.png deleted file mode 100755 index dde84945f695fb94f33a9712ef851b5b8f848dd2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 107 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDH3?y^UWFG-iYymzYu0R?HmZtAK52P4Ng8YIR y9G=}s19F5tT^vIy7?T%pKKTFt|KSJAGZ-1Z%DL}6-e{x-(&Ops=d#Wzp$P! +# +# 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. +# +# HomeFlix-Local_de_DE.properties German Local -#main window translations +# main window translations info = Info settings = Einstellungen streamingSettings = Stream Einst. tfSearch = Suche... openFolder = Ordner \u00F6ffnen -#settings translations +# settings translations homeflixSettingsLbl = HomeFlix Einstellungen filmDirTextField = Pfad... addDirectory = Ordner hinzuf\u00FCgen @@ -24,18 +43,18 @@ autoplay = autoplay branchLbl = Updatezweig sourcesLbl = Quellen -#column translations +# column translations columnStreamUrl = Datei Name columnName = Name columnSeason = Staffel columnEpisode = Episode columnFavorite = Favorit -#error translations +# 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-2019 mosad www.mosad.xyz -#textFlow translations +# textFlow translations title = Titel year = Jahr rated = Einstufung @@ -57,11 +76,15 @@ type = Type boxOffice = BoxOffice website = Webseite -#first start +# first start addSourceHeader = Neue Quelle hinzuf\u00FCgen addSourceBody = HomeFlix konnte keine Quelle finden. \nFüge eine loakels Verzeichniss oder eine Sreaming Datei als neue Quelle hinzu. cancelBtnText = Abbrechen -#DetailView +# DetailView crew = Haupt-Crew score = Benutzerbewertung + +# player +nextEpisode = Nächste Folge in\u0020 +seconds = \u0020Sekunden diff --git a/src/main/resources/locals/HomeFlix-Local_en_US.properties b/src/main/resources/locals/HomeFlix-Local_en_US.properties index a2166c7..2befc66 100644 --- a/src/main/resources/locals/HomeFlix-Local_en_US.properties +++ b/src/main/resources/locals/HomeFlix-Local_en_US.properties @@ -1,13 +1,32 @@ -#HomeFlix-Local_en_US.properties US-English Local and default +# Project-HomeFlix +# +# Copyright 2016-2020 +# +# 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. +# +# HomeFlix-Local_en_US.properties US-English Local and default -#main window translations +# main window translations info = Info settings = Settings streamingSettings = Stream Settings tfSearch = Search... openFolder = open Folder -#settings translations +# settings translations homeflixSettingsLbl = HomeFlix Settings filmDirTextField = Path... addDirectory = add directory @@ -24,18 +43,18 @@ autoplay = autoplay branchLbl = Branch sourcesLbl = Quellen -#column translations +# column translations columnStreamUrl = File Name columnName = Name columnSeason = Season columnEpisode = Episode columnFavorite = Favorite -#error translations +# 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-2019 mosad www.mosad.xyz -#textFlow translations +# textFlow translations title = Title year = Year rated = Rating @@ -57,11 +76,15 @@ type = Type boxOffice = BoxOffice website = Website -#first start +# first startnext episode in addSourceHeader = add a new source addSourceBody = HomeFlix was not able to load a source. \nAdd a new local directory oa a streaming file as new source. cancelBtnText = cancel -#DetailView +# DetailView crew = Featured Crew score = User Score + +# player +nextEpisode = next episode in\u0020 +seconds = \u0020seconds