added getAllNotCachedEntries()
* added a method to get all not cached entries from the films db
This commit is contained in:
@ -465,7 +465,7 @@ public class DBController {
|
||||
public void setCached(String streamUrl) {
|
||||
try {
|
||||
Statement stmt = connection.createStatement();
|
||||
stmt.executeUpdate("UPDATE films SET cached=1 WHERE streamUrl=\"" + streamUrl + "\";");
|
||||
stmt.executeUpdate("UPDATE films SET cached = 1 WHERE streamUrl = \"" + streamUrl + "\";");
|
||||
connection.commit();
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
@ -623,6 +623,29 @@ public class DBController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get all NOT cached entries
|
||||
* @return a {@link ArrayList} of all NOT cached entries
|
||||
*/
|
||||
public ArrayList<FilmTabelDataType> getAllNotCachedEntries() {
|
||||
ArrayList<FilmTabelDataType> notCachedEntries = new ArrayList<>();
|
||||
|
||||
try {
|
||||
Statement stmt = connection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery("SELECT * FROM films WHERE cached = 0");
|
||||
while (rs.next()) {
|
||||
notCachedEntries.add(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)));
|
||||
}
|
||||
stmt.close();
|
||||
rs.close();
|
||||
} catch (SQLException e) {
|
||||
LOGGER.error("An error occured, while getting all NOT cached entries", e);
|
||||
}
|
||||
return notCachedEntries;
|
||||
}
|
||||
|
||||
/**
|
||||
* return the currentTime in ms saved in the database
|
||||
* @param streamUrl URL of the film
|
||||
|
Reference in New Issue
Block a user