minor code cleanup
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
5e71bb95f0
commit
e4cc195fa8
|
@ -358,14 +358,12 @@ public class MainWindowController {
|
||||||
* check if all posters are cached, if not cache the missing ones
|
* check if all posters are cached, if not cache the missing ones
|
||||||
*/
|
*/
|
||||||
void checkAllPosters() {
|
void checkAllPosters() {
|
||||||
dbController.refreshDataBase(); // refreshes the database after a source path was added
|
|
||||||
|
|
||||||
// get all not cached entries, none of them should have a cached poster
|
|
||||||
ExecutorService executor = Executors.newFixedThreadPool(5);
|
ExecutorService executor = Executors.newFixedThreadPool(5);
|
||||||
|
|
||||||
for (FilmTabelDataType entry : dbController.getAllNotCachedEntries()) {
|
dbController.refreshDataBase(); // refreshes the database after a source path was added
|
||||||
// System.out.println(entry.getStreamUrl() + " is NOT cached!");
|
|
||||||
|
|
||||||
|
// get all not cached entries
|
||||||
|
for (FilmTabelDataType entry : dbController.getAllNotCachedEntries()) {
|
||||||
Runnable OMDbAPIWorker = new OMDbAPIController(entry);
|
Runnable OMDbAPIWorker = new OMDbAPIController(entry);
|
||||||
executor.execute(OMDbAPIWorker);
|
executor.execute(OMDbAPIWorker);
|
||||||
}
|
}
|
||||||
|
@ -373,7 +371,7 @@ public class MainWindowController {
|
||||||
|
|
||||||
// TODO show loading screen
|
// TODO show loading screen
|
||||||
|
|
||||||
// we might need this as otherwise it would load before all tasks are finished
|
// wait for all OMDbAPI requests to finish
|
||||||
try {
|
try {
|
||||||
executor.awaitTermination(1, TimeUnit.MINUTES);
|
executor.awaitTermination(1, TimeUnit.MINUTES);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|
|
@ -420,7 +420,7 @@ public class DBController {
|
||||||
connection.commit();
|
connection.commit();
|
||||||
ps.close();
|
ps.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Ups! an error occured!", e);
|
LOGGER.error("Ups! An error occured!", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ public class DBController {
|
||||||
connection.commit();
|
connection.commit();
|
||||||
ps.close();
|
ps.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Ups! an error occured!", e);
|
LOGGER.error("Ups! An error occured, while setting cached = DATE for {}.", streamUrl, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ public class DBController {
|
||||||
rs.close();
|
rs.close();
|
||||||
ps.close();
|
ps.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Ups! an error occured!", e);
|
LOGGER.error("Ups! An error occured, while rerading the cached date for {}.", streamUrl, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cacheDate;
|
return cacheDate;
|
||||||
|
@ -507,7 +507,7 @@ public class DBController {
|
||||||
connection.commit();
|
connection.commit();
|
||||||
ps.close();
|
ps.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error(e);
|
LOGGER.error("Ups! An error while adding cache data for {}.", streamUrl, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,7 +526,7 @@ public class DBController {
|
||||||
rs.close();
|
rs.close();
|
||||||
ps.close();
|
ps.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Ups! error while getting the current time!", e);
|
LOGGER.error("Ups! An error while searching for {} in the cache.", streamUrl, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return retValue;
|
return retValue;
|
||||||
|
@ -572,7 +572,7 @@ public class DBController {
|
||||||
rs.close();
|
rs.close();
|
||||||
ps.close();
|
ps.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Ups! an error occured!", e);
|
LOGGER.error("Ups! error while getting the current time for {}.", streamUrl, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cacheData;
|
return cacheData;
|
||||||
|
|
Loading…
Reference in New Issue