use gitea instead of github
* use gitea instead of github * use prepareStatement instead of statement
This commit is contained in:
@ -321,7 +321,6 @@ public class DBController {
|
||||
* @throws IOException
|
||||
*/
|
||||
private void checkAddEntry() throws SQLException, FileNotFoundException, IOException {
|
||||
Statement stmt = connection.createStatement();
|
||||
PreparedStatement ps = connection.prepareStatement("insert into films values (?, ?, ?, ?, ?, ?, ?)");
|
||||
LOGGER.info("checking for entrys to add to DB ...");
|
||||
|
||||
@ -334,12 +333,15 @@ public class DBController {
|
||||
// if file is file and has mime type "video"
|
||||
if (file.isFile() && mimeType != null && mimeType.contains("video")) {
|
||||
// get all files (films)
|
||||
if (!filmsdbStreamURL.contains(file.getPath())) {
|
||||
stmt.executeUpdate("insert into films values ("
|
||||
+ "'" + file.getPath() + "',"
|
||||
+ "'" + cutOffEnd(file.getName()) + "', '', '', 0, 0, 0.0)");
|
||||
connection.commit();
|
||||
stmt.close();
|
||||
if (!filmsdbStreamURL.contains(file.getPath())) {
|
||||
ps.setString(1, file.getPath());
|
||||
ps.setString(2, cutOffEnd(file.getName()));
|
||||
ps.setString(3, "");
|
||||
ps.setString(4, "");
|
||||
ps.setInt(5, 0);
|
||||
ps.setBoolean(6, false);
|
||||
ps.setDouble(7, 0);
|
||||
ps.addBatch(); // adds the entry
|
||||
LOGGER.info("Added \"" + file.getName() + "\" to database");
|
||||
filmsdbStreamURL.add(file.getPath());
|
||||
}
|
||||
@ -350,13 +352,16 @@ public class DBController {
|
||||
if (season.isDirectory()) {
|
||||
int ep = 1;
|
||||
for (File episode : season.listFiles()) {
|
||||
if (!filmsdbStreamURL.contains(episode.getPath())) {
|
||||
if (!filmsdbStreamURL.contains(episode.getPath())) {
|
||||
ps.setString(1, episode.getPath().replace("'", "''"));
|
||||
ps.setString(2, cutOffEnd(file.getName()));
|
||||
ps.setString(3, Integer.toString(sn));
|
||||
ps.setString(4, Integer.toString(ep));
|
||||
ps.setInt(5, 0);
|
||||
ps.setBoolean(6, false);
|
||||
ps.setDouble(7, 0);
|
||||
ps.addBatch(); // adds the entry
|
||||
LOGGER.info("Added \"" + file.getName() + "\", Episode: " + episode.getName() + " to database");
|
||||
stmt.executeUpdate("insert into films values ("
|
||||
+ "'" + episode.getPath().replace("'", "''") + "',"
|
||||
+ "'" + cutOffEnd(file.getName()) + "','" + sn + "','" + ep + "', 0, 0, 0.0)");
|
||||
connection.commit();
|
||||
stmt.close();
|
||||
filmsStreamURL.add(episode.getPath());
|
||||
filmsdbStreamURL.add(episode.getPath());
|
||||
ep++;
|
||||
|
Reference in New Issue
Block a user