replace stop button with back button, show media title
continuous-integration/drone/push Build is passing Details

* show next episode 30 sec before end
* translate next episode btn
This commit is contained in:
Jannik 2020-04-18 13:19:24 +02:00
parent c6b2d1a9d8
commit 965c081d05
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
6 changed files with 88 additions and 46 deletions

View File

@ -72,7 +72,7 @@ public class PlayerController {
@FXML private JFXSlider timeSlider; @FXML private JFXSlider timeSlider;
@FXML private JFXButton stopBtn; @FXML private JFXButton btnBack;
@FXML private JFXButton playBtn; @FXML private JFXButton playBtn;
@FXML private JFXButton fullscreenBtn; @FXML private JFXButton fullscreenBtn;
@FXML private JFXButton nextEpBtn; @FXML private JFXButton nextEpBtn;
@ -90,7 +90,7 @@ public class PlayerController {
private WritableImage videoImage; private WritableImage videoImage;
private PixelBuffer<ByteBuffer> videoPixelBuffer; private PixelBuffer<ByteBuffer> videoPixelBuffer;
private FilmTabelDataType film; private FilmTabelDataType media;
private long startTime = 0; private long startTime = 0;
private long currentTime = 0; private long currentTime = 0;
private long endTime = 0; private long endTime = 0;
@ -115,7 +115,7 @@ public class PlayerController {
*/ */
public PlayerController(Player player, String mediaURL) { public PlayerController(Player player, String mediaURL) {
this.player = player; this.player = player;
this.film = DBController.getInstance().getStream(mediaURL); this.media = DBController.getInstance().getStream(mediaURL);
mediaPlayerFactory = new MediaPlayerFactory(); mediaPlayerFactory = new MediaPlayerFactory();
embeddedMediaPlayer = mediaPlayerFactory.mediaPlayers().newEmbeddedMediaPlayer(); embeddedMediaPlayer = mediaPlayerFactory.mediaPlayers().newEmbeddedMediaPlayer();
@ -129,12 +129,12 @@ public class PlayerController {
videoImageView.fitHeightProperty().bind(player.getStage().heightProperty()); videoImageView.fitHeightProperty().bind(player.getStage().heightProperty());
// set needed variables // set needed variables
startTime = (long) DBController.getInstance().getCurrentTime(film.getStreamUrl()); startTime = (long) DBController.getInstance().getCurrentTime(media.getStreamUrl());
autoplay = XMLController.isAutoplay(); autoplay = XMLController.isAutoplay();
season = !film.getSeason().isEmpty() ? Integer.parseInt(film.getSeason()) : 0; season = !media.getSeason().isEmpty() ? Integer.parseInt(media.getSeason()) : 0;
episode = !film.getEpisode().isEmpty() ? Integer.parseInt(film.getEpisode()) : 0; episode = !media.getEpisode().isEmpty() ? Integer.parseInt(media.getEpisode()) : 0;
lblTitle.setText(film.getTitle()); lblTitle.setText(media.getTitle());
initPlayerWindow(); initPlayerWindow();
initMediaPlayer(); initMediaPlayer();
@ -235,12 +235,12 @@ public class PlayerController {
} }
public void start() { public void start() {
embeddedMediaPlayer.media().play(film.getStreamUrl()); embeddedMediaPlayer.media().play(media.getStreamUrl());
embeddedMediaPlayer.controls().skipTime((long) startTime); // skipt to the start time embeddedMediaPlayer.controls().skipTime((long) startTime); // skipt to the start time
} }
public void stop() { public void stop() {
DBController.getInstance().setCurrentTime(film.getStreamUrl(), embeddedMediaPlayer.status().time()); DBController.getInstance().setCurrentTime(media.getStreamUrl(), embeddedMediaPlayer.status().time());
embeddedMediaPlayer.controls().stop(); embeddedMediaPlayer.controls().stop();
embeddedMediaPlayer.release(); embeddedMediaPlayer.release();
mediaPlayerFactory.release(); mediaPlayerFactory.release();
@ -262,16 +262,17 @@ public class PlayerController {
TimeUnit.MILLISECONDS.toSeconds(endTime) % 60)); TimeUnit.MILLISECONDS.toSeconds(endTime) % 60));
// show the next episode button 20 seconds before the end of a episode // show the next episode button 30 seconds before the end of a episode
if (endTime < 21000 && episode != 0 && autoplay) { if (endTime < 31000 && episode != 0 && autoplay) {
int countdown = (int) ((endTime / 1000) - 10); // a 10 seconds countdown int countdown = (int) ((endTime / 1000) - 20); // a 10 seconds countdown
if (!nextEpBtn.isVisible()) { if (!nextEpBtn.isVisible()) {
nextEpBtn.setVisible(true); nextEpBtn.setVisible(true);
} }
if (endTime > 10000) { if (endTime > 20000) {
nextEpBtn.setText("next episode in " + countdown + " seconds"); // TODO translate nextEpBtn.setText(XMLController.getLocalBundle().getString("nextEpisode")
+ countdown + XMLController.getLocalBundle().getString("seconds"));
bottomVBox.setVisible(true); bottomVBox.setVisible(true);
System.out.println("next episode in " + countdown + " seconds"); System.out.println("next episode in " + countdown + " seconds");
} else { } else {
@ -281,9 +282,9 @@ public class PlayerController {
} }
} }
} }
@FXML @FXML
void stopBtnAction(ActionEvent event) { void btnBackAction(ActionEvent event) {
stop(); stop();
player.getStage().close(); player.getStage().close();
} }
@ -317,11 +318,11 @@ public class PlayerController {
private void playNextMedia() { private void playNextMedia() {
autoplay = false; autoplay = false;
DBController.getInstance().setCurrentTime(film.getStreamUrl(), 0); // reset old video start time DBController.getInstance().setCurrentTime(media.getStreamUrl(), 0); // reset old video start time
FilmTabelDataType nextFilm = DBController.getInstance().getNextEpisode(film.getTitle(), episode, season); FilmTabelDataType nextMedia = DBController.getInstance().getNextEpisode(media.getTitle(), episode, season);
if (nextFilm != null) { if (nextMedia != null) {
//mediaPlayer2.stop(); //mediaPlayer2.stop();
film = nextFilm; media = nextMedia;
autoplay = true; autoplay = true;
} }
} }

View File

@ -22,9 +22,12 @@
</HBox> </HBox>
<HBox fx:id="hBoxTop" alignment="CENTER_LEFT" spacing="10.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <HBox fx:id="hBoxTop" alignment="CENTER_LEFT" spacing="10.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children> <children>
<JFXButton> <JFXButton fx:id="btnBack" contentDisplay="GRAPHIC_ONLY" onAction="#btnBackAction" style="-fx-background-color: transparent;">
<graphic> <graphic>
<ImageView pickOnBounds="true" preserveRatio="true" /> <ImageView fitHeight="24.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/baseline_keyboard_backspace_white_48dp.png" />
</image></ImageView>
</graphic> </graphic>
</JFXButton> </JFXButton>
<Label fx:id="lblTitle" text="Title" textFill="WHITE"> <Label fx:id="lblTitle" text="Title" textFill="WHITE">
@ -57,14 +60,6 @@
</HBox> </HBox>
<HBox fx:id="controlsHBox" alignment="CENTER" spacing="10.0"> <HBox fx:id="controlsHBox" alignment="CENTER" spacing="10.0">
<children> <children>
<JFXButton fx:id="stopBtn" buttonType="RAISED" contentDisplay="GRAPHIC_ONLY" onAction="#stopBtnAction" prefHeight="39.0" style="-fx-background-color: white;">
<graphic>
<ImageView fx:id="stopIcon" fitHeight="29.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/baseline_stop_black_48dp.png" />
</image>
</ImageView>
</graphic></JFXButton>
<JFXButton fx:id="playBtn" buttonType="RAISED" contentDisplay="GRAPHIC_ONLY" onAction="#playBtnAction" prefHeight="39.0" style="-fx-background-color: white;"> <JFXButton fx:id="playBtn" buttonType="RAISED" contentDisplay="GRAPHIC_ONLY" onAction="#playBtnAction" prefHeight="39.0" style="-fx-background-color: white;">
<graphic> <graphic>
<ImageView fx:id="playIcon" fitHeight="29.0" pickOnBounds="true" preserveRatio="true"> <ImageView fx:id="playIcon" fitHeight="29.0" pickOnBounds="true" preserveRatio="true">

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

View File

@ -1,13 +1,32 @@
#HomeFlix-Local_de_DE.properties German Local # Project-HomeFlix
#
# Copyright 2016-2020 <seil0@mosad.xyz>
#
# 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 info = Info
settings = Einstellungen settings = Einstellungen
streamingSettings = Stream Einst. streamingSettings = Stream Einst.
tfSearch = Suche... tfSearch = Suche...
openFolder = Ordner \u00F6ffnen openFolder = Ordner \u00F6ffnen
#settings translations # settings translations
homeflixSettingsLbl = HomeFlix Einstellungen homeflixSettingsLbl = HomeFlix Einstellungen
filmDirTextField = Pfad... filmDirTextField = Pfad...
addDirectory = Ordner hinzuf\u00FCgen addDirectory = Ordner hinzuf\u00FCgen
@ -24,18 +43,18 @@ autoplay = autoplay
branchLbl = Updatezweig branchLbl = Updatezweig
sourcesLbl = Quellen sourcesLbl = Quellen
#column translations # column translations
columnStreamUrl = Datei Name columnStreamUrl = Datei Name
columnName = Name columnName = Name
columnSeason = Staffel columnSeason = Staffel
columnEpisode = Episode columnEpisode = Episode
columnFavorite = Favorit columnFavorite = Favorit
#error translations # error translations
vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt! 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 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 title = Titel
year = Jahr year = Jahr
rated = Einstufung rated = Einstufung
@ -57,11 +76,15 @@ type = Type
boxOffice = BoxOffice boxOffice = BoxOffice
website = Webseite website = Webseite
#first start # first start
addSourceHeader = Neue Quelle hinzuf\u00FCgen addSourceHeader = Neue Quelle hinzuf\u00FCgen
addSourceBody = HomeFlix konnte keine Quelle finden. \nFüge eine loakels Verzeichniss oder eine Sreaming Datei als neue Quelle hinzu. addSourceBody = HomeFlix konnte keine Quelle finden. \nFüge eine loakels Verzeichniss oder eine Sreaming Datei als neue Quelle hinzu.
cancelBtnText = Abbrechen cancelBtnText = Abbrechen
#DetailView # DetailView
crew = Haupt-Crew crew = Haupt-Crew
score = Benutzerbewertung score = Benutzerbewertung
# player
nextEpisode = Nächste Folge in\u0020
seconds = \u0020Sekunden

View File

@ -1,13 +1,32 @@
#HomeFlix-Local_en_US.properties US-English Local and default # Project-HomeFlix
#
# Copyright 2016-2020 <seil0@mosad.xyz>
#
# 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 info = Info
settings = Settings settings = Settings
streamingSettings = Stream Settings streamingSettings = Stream Settings
tfSearch = Search... tfSearch = Search...
openFolder = open Folder openFolder = open Folder
#settings translations # settings translations
homeflixSettingsLbl = HomeFlix Settings homeflixSettingsLbl = HomeFlix Settings
filmDirTextField = Path... filmDirTextField = Path...
addDirectory = add directory addDirectory = add directory
@ -24,18 +43,18 @@ autoplay = autoplay
branchLbl = Branch branchLbl = Branch
sourcesLbl = Quellen sourcesLbl = Quellen
#column translations # column translations
columnStreamUrl = File Name columnStreamUrl = File Name
columnName = Name columnName = Name
columnSeason = Season columnSeason = Season
columnEpisode = Episode columnEpisode = Episode
columnFavorite = Favorite columnFavorite = Favorite
#error translations # error translations
vlcNotInstalled = VLC Media Player is required to play a movie! 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 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 title = Title
year = Year year = Year
rated = Rating rated = Rating
@ -57,11 +76,15 @@ type = Type
boxOffice = BoxOffice boxOffice = BoxOffice
website = Website website = Website
#first start # first startnext episode in
addSourceHeader = add a new source 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. addSourceBody = HomeFlix was not able to load a source. \nAdd a new local directory oa a streaming file as new source.
cancelBtnText = cancel cancelBtnText = cancel
#DetailView # DetailView
crew = Featured Crew crew = Featured Crew
score = User Score score = User Score
# player
nextEpisode = next episode in\u0020
seconds = \u0020seconds