series work
if there is more than one season of a series homeflix should manage that too
This commit is contained in:
		| @ -218,9 +218,9 @@ public class MainWindowController { | ||||
| 	private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName()); | ||||
| 	private int hashA = -647380320; | ||||
|  | ||||
| 	private String version = "0.6.99"; | ||||
| 	private String buildNumber = "147"; | ||||
| 	private String versionName = "glowing vampire"; | ||||
| 	private String version = "0.6.100"; | ||||
| 	private String buildNumber = "149"; | ||||
| 	private String versionName = "toothless dragon RC"; | ||||
| 	private String dialogBtnStyle; | ||||
| 	private String color; | ||||
| 	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) { | ||||
| 		boolean retValue = false; | ||||
| 		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  | ||||
| 	 * @param title	URL of the film | ||||
| 	 * @param nextEp	number of the next episode | ||||
| 	 * @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; | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			ResultSet rs = stmt.executeQuery("SELECT * FROM films WHERE title = \"" + title + "\" AND episode = \"" + nextEp + "\";"); | ||||
| 			while (rs.next()) { | ||||
| 			ResultSet rs = stmt.executeQuery("SELECT * FROM films WHERE title = \"" + title + "\" AND episode = \"" | ||||
| 					+ nextEp + "\" AND season = \"" + season + "\";"); | ||||
| 			if (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"), | ||||
| 					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"), | ||||
| 					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)); | ||||
| 				} | ||||
| 			} 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(); | ||||
| 			stmt.close(); | ||||
| 		} catch (Exception e) { | ||||
| 			LOGGER.error("Ups! error while getting next episode!", e); | ||||
| 		}  | ||||
| 		} | ||||
| 		return nextFilm; | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	/** TODO check if we relay need to separate between favorites and none favorites | ||||
| 	 * get the last watched episode | ||||
| 	 * @param title the title of the series | ||||
| 	 * @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) { | ||||
| 				currentTime = newValue.toMillis(); // set the current time | ||||
| 				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 ((duration - currentTime) < 10000 && episode != 0 && autoplay) { | ||||
| 					autoplay = false; | ||||
| 					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) { | ||||
| 						mediaPlayer.stop(); | ||||
| 						init(mainWCon, player, nextFilm); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user