series work
if there is more than one season of a series homeflix should manage that too
This commit is contained in:
parent
94e32b938a
commit
0c1b21ac05
|
@ -218,9 +218,9 @@ public class MainWindowController {
|
||||||
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
|
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
|
||||||
private int hashA = -647380320;
|
private int hashA = -647380320;
|
||||||
|
|
||||||
private String version = "0.6.99";
|
private String version = "0.6.100";
|
||||||
private String buildNumber = "147";
|
private String buildNumber = "149";
|
||||||
private String versionName = "glowing vampire";
|
private String versionName = "toothless dragon RC";
|
||||||
private String dialogBtnStyle;
|
private String dialogBtnStyle;
|
||||||
private String color;
|
private String color;
|
||||||
private String local;
|
private String local;
|
||||||
|
|
|
@ -541,6 +541,11 @@ public class DBController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks if there is already a entry with the given streamUrl in the cache
|
||||||
|
* @param streamUrl URL of the element
|
||||||
|
* @return true if the element is already cached, else false
|
||||||
|
*/
|
||||||
public boolean searchCache(String streamUrl) {
|
public boolean searchCache(String streamUrl) {
|
||||||
boolean retValue = false;
|
boolean retValue = false;
|
||||||
try {
|
try {
|
||||||
|
@ -661,37 +666,52 @@ public class DBController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** TODO check if we relay need to separate between favorites and none favorites
|
||||||
* get the next episode of a
|
* get the next episode of a
|
||||||
* @param title URL of the film
|
* @param title URL of the film
|
||||||
* @param nextEp number of the next episode
|
* @param nextEp number of the next episode
|
||||||
* @return {@link FilmTabelDataType} the next episode as object
|
* @return {@link FilmTabelDataType} the next episode as object
|
||||||
*/
|
*/
|
||||||
public FilmTabelDataType getNextEpisode(String title, int nextEp) {
|
public FilmTabelDataType getNextEpisode(String title, int nextEp, int season) {
|
||||||
FilmTabelDataType nextFilm = null;
|
FilmTabelDataType nextFilm = null;
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery("SELECT * FROM films WHERE title = \"" + title + "\" AND episode = \"" + nextEp + "\";");
|
ResultSet rs = stmt.executeQuery("SELECT * FROM films WHERE title = \"" + title + "\" AND episode = \""
|
||||||
while (rs.next()) {
|
+ nextEp + "\" AND season = \"" + season + "\";");
|
||||||
|
if (rs.next()) {
|
||||||
if (rs.getBoolean("favorite") == true) {
|
if (rs.getBoolean("favorite") == true) {
|
||||||
nextFilm = new FilmTabelDataType(rs.getString("streamUrl"),
|
nextFilm = new FilmTabelDataType(rs.getString("streamUrl"), rs.getString("title"),
|
||||||
rs.getString("title"), rs.getString("season"), rs.getString("episode") ,rs.getBoolean("favorite"),
|
rs.getString("season"), rs.getString("episode"), rs.getBoolean("favorite"),
|
||||||
rs.getBoolean("cached"), new ImageView(favorite_black));
|
rs.getBoolean("cached"), new ImageView(favorite_black));
|
||||||
} else {
|
} else {
|
||||||
nextFilm = new FilmTabelDataType(rs.getString("streamUrl"),
|
nextFilm = new FilmTabelDataType(rs.getString("streamUrl"), rs.getString("title"),
|
||||||
rs.getString("title"), rs.getString("season"), rs.getString("episode"), rs.getBoolean("favorite"),
|
rs.getString("season"), rs.getString("episode"), rs.getBoolean("favorite"),
|
||||||
rs.getBoolean("cached"), new ImageView(favorite_border_black));
|
rs.getBoolean("cached"), new ImageView(favorite_border_black));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
rs = stmt.executeQuery("SELECT * FROM films WHERE title = \"" + title
|
||||||
|
+ "\" AND episode = \"1\" AND season = \"" + (season + 1) + "\";");
|
||||||
|
while (rs.next()) {
|
||||||
|
if (rs.getBoolean("favorite") == true) {
|
||||||
|
nextFilm = new FilmTabelDataType(rs.getString("streamUrl"), rs.getString("title"),
|
||||||
|
rs.getString("season"), rs.getString("episode"), rs.getBoolean("favorite"),
|
||||||
|
rs.getBoolean("cached"), new ImageView(favorite_black));
|
||||||
|
} else {
|
||||||
|
nextFilm = new FilmTabelDataType(rs.getString("streamUrl"), rs.getString("title"),
|
||||||
|
rs.getString("season"), rs.getString("episode"), rs.getBoolean("favorite"),
|
||||||
|
rs.getBoolean("cached"), new ImageView(favorite_border_black));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Ups! error while getting next episode!", e);
|
LOGGER.error("Ups! error while getting next episode!", e);
|
||||||
}
|
}
|
||||||
return nextFilm;
|
return nextFilm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** TODO check if we relay need to separate between favorites and none favorites
|
||||||
* get the last watched episode
|
* get the last watched episode
|
||||||
* @param title the title of the series
|
* @param title the title of the series
|
||||||
* @return the last watched episode as {@link FilmTabelDataType} object
|
* @return the last watched episode as {@link FilmTabelDataType} object
|
||||||
|
|
|
@ -143,12 +143,13 @@ public class PlayerController {
|
||||||
public void changed(ObservableValue<? extends Duration> observable, Duration oldValue, Duration newValue) {
|
public void changed(ObservableValue<? extends Duration> observable, Duration oldValue, Duration newValue) {
|
||||||
currentTime = newValue.toMillis(); // set the current time
|
currentTime = newValue.toMillis(); // set the current time
|
||||||
int episode = !film.getEpisode().isEmpty() ? Integer.parseInt(film.getEpisode()) : 0;
|
int episode = !film.getEpisode().isEmpty() ? Integer.parseInt(film.getEpisode()) : 0;
|
||||||
|
int season = !film.getSeason().isEmpty() ? Integer.parseInt(film.getSeason()) : 0;
|
||||||
|
|
||||||
// if we are end time -10 seconds, do autoplay, if activated
|
// if we are end time -10 seconds, do autoplay, if activated
|
||||||
if ((duration - currentTime) < 10000 && episode != 0 && autoplay) {
|
if ((duration - currentTime) < 10000 && episode != 0 && autoplay) {
|
||||||
autoplay = false;
|
autoplay = false;
|
||||||
mainWCon.getDbController().setCurrentTime(film.getStreamUrl(), 0); // reset old video start time
|
mainWCon.getDbController().setCurrentTime(film.getStreamUrl(), 0); // reset old video start time
|
||||||
FilmTabelDataType nextFilm = mainWCon.getDbController().getNextEpisode(film.getTitle(), (episode + 1));
|
FilmTabelDataType nextFilm = mainWCon.getDbController().getNextEpisode(film.getTitle(), (episode + 1), season);
|
||||||
if (nextFilm != null) {
|
if (nextFilm != null) {
|
||||||
mediaPlayer.stop();
|
mediaPlayer.stop();
|
||||||
init(mainWCon, player, nextFilm);
|
init(mainWCon, player, nextFilm);
|
||||||
|
|
Loading…
Reference in New Issue