This commit is contained in:
		| @ -358,28 +358,26 @@ public class MainWindowController { | ||||
| 	 * check if all posters are cached, if not cache the missing ones | ||||
| 	 */ | ||||
| 	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); | ||||
|  | ||||
| 		for (FilmTabelDataType entry : dbController.getAllNotCachedEntries()) { | ||||
| //			System.out.println(entry.getStreamUrl() + " is NOT cached!"); | ||||
| 		dbController.refreshDataBase(); // refreshes the database after a source path was added | ||||
|  | ||||
| 		// get all not cached entries | ||||
| 		for (FilmTabelDataType entry : dbController.getAllNotCachedEntries()) { | ||||
| 			Runnable OMDbAPIWorker = new OMDbAPIController(entry); | ||||
| 			executor.execute(OMDbAPIWorker); | ||||
| 		} | ||||
| 		executor.shutdown(); | ||||
|  | ||||
| 		// 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 { | ||||
| 			executor.awaitTermination(1, TimeUnit.MINUTES); | ||||
| 		} catch (InterruptedException e) { | ||||
| 			LOGGER.error(e); | ||||
| 		} | ||||
| 		 | ||||
|  | ||||
| 		System.out.println("finished refresh"); | ||||
| 	} | ||||
| 	 | ||||
|  | ||||
| @ -420,7 +420,7 @@ public class DBController { | ||||
| 			connection.commit(); | ||||
| 			ps.close(); | ||||
| 		} 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(); | ||||
| 			ps.close(); | ||||
| 		} 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(); | ||||
| 			ps.close(); | ||||
| 		} 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; | ||||
| @ -507,7 +507,7 @@ public class DBController { | ||||
| 			connection.commit(); | ||||
| 			ps.close(); | ||||
| 		} 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(); | ||||
| 			ps.close(); | ||||
| 		} 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; | ||||
| @ -572,7 +572,7 @@ public class DBController { | ||||
| 			rs.close(); | ||||
| 			ps.close(); | ||||
| 		} catch (SQLException e) { | ||||
| 			LOGGER.error("Ups! an error occured!", e); | ||||
| 			LOGGER.error("Ups! error while getting the current time for {}.", streamUrl, e); | ||||
| 		} | ||||
| 		 | ||||
| 		return cacheData; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user