release 0.8.0 #12
@ -826,8 +826,6 @@ public class MainWindowController {
 | 
				
			|||||||
			
 | 
								
 | 
				
			||||||
			Runnable OMDbAPIWorker = new OMDbAPIController(main, dbController, entry, omdbAPIKey, false);
 | 
								Runnable OMDbAPIWorker = new OMDbAPIController(main, dbController, entry, omdbAPIKey, false);
 | 
				
			||||||
			executor.execute(OMDbAPIWorker);
 | 
								executor.execute(OMDbAPIWorker);
 | 
				
			||||||
			
 | 
					 | 
				
			||||||
			// TODO for entries not available show homeflix logo and set cached
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		executor.shutdown();
 | 
							executor.shutdown();
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
				
			|||||||
@ -389,7 +389,7 @@ public class DBController {
 | 
				
			|||||||
		try {
 | 
							try {
 | 
				
			||||||
			PreparedStatement ps = connection.prepareStatement("insert into cache values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
 | 
								PreparedStatement ps = connection.prepareStatement("insert into cache values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			LOGGER.info("adding to cache: " + omdbResponse.getTitle());
 | 
								LOGGER.info("adding cache for: " + streamUrl);
 | 
				
			||||||
			ps.setString(1,streamUrl);
 | 
								ps.setString(1,streamUrl);
 | 
				
			||||||
			ps.setString(2,omdbResponse.getTitle());
 | 
								ps.setString(2,omdbResponse.getTitle());
 | 
				
			||||||
			ps.setString(3,omdbResponse.getYear());
 | 
								ps.setString(3,omdbResponse.getYear());
 | 
				
			||||||
@ -550,6 +550,8 @@ public class DBController {
 | 
				
			|||||||
		} catch (SQLException e) {
 | 
							} catch (SQLException e) {
 | 
				
			||||||
			LOGGER.error("An error occured, while getting all NOT cached entries", e);
 | 
								LOGGER.error("An error occured, while getting all NOT cached entries", e);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							LOGGER.info("There are {} entries not Chached!", notCachedEntries.size());
 | 
				
			||||||
		return notCachedEntries;
 | 
							return notCachedEntries;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
				
			|||||||
@ -73,13 +73,19 @@ public class OMDbAPIController implements Runnable {
 | 
				
			|||||||
		LOGGER.info("Querying omdbAPI ...");
 | 
							LOGGER.info("Querying omdbAPI ...");
 | 
				
			||||||
		JsonObject object;
 | 
							JsonObject object;
 | 
				
			||||||
		object = getByTitle(currentTableFilm.getTitle());
 | 
							object = getByTitle(currentTableFilm.getTitle());
 | 
				
			||||||
		if (object == null) return;
 | 
							if (object == null) {
 | 
				
			||||||
 | 
								LOGGER.error("Fatal error while querying omdbAPI!");
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							// if the answer contains "not found!" try to search by title
 | 
				
			||||||
		if (object.getString("Error", "").contains("not found!")) {
 | 
							if (object.getString("Error", "").contains("not found!")) {
 | 
				
			||||||
			String title = searchByTitle(currentTableFilm.getTitle());
 | 
								String title = searchByTitle(currentTableFilm.getTitle());
 | 
				
			||||||
			if (title.length() > 0) {
 | 
								if (title.length() > 0) {
 | 
				
			||||||
 | 
									// we have at least on answer, get info by title now
 | 
				
			||||||
				object = getByTitle(title);
 | 
									object = getByTitle(title);
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
 | 
									// if we still have nothing found, get info by title without episode
 | 
				
			||||||
				if(object.getString("Error", "").contains("Series or episode not found!")) {
 | 
									if(object.getString("Error", "").contains("Series or episode not found!")) {
 | 
				
			||||||
					useEpisode = false;
 | 
										useEpisode = false;
 | 
				
			||||||
					object = getByTitle(title);
 | 
										object = getByTitle(title);
 | 
				
			||||||
@ -127,6 +133,8 @@ public class OMDbAPIController implements Runnable {
 | 
				
			|||||||
			LOGGER.error(e);
 | 
								LOGGER.error(e);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							synchronized (this) {
 | 
				
			||||||
			// adding to cache
 | 
								// adding to cache
 | 
				
			||||||
			dbController.addCache(currentTableFilm.getStreamUrl(), omdbResponse);
 | 
								dbController.addCache(currentTableFilm.getStreamUrl(), omdbResponse);
 | 
				
			||||||
			dbController.setCached(currentTableFilm.getStreamUrl());
 | 
								dbController.setCached(currentTableFilm.getStreamUrl());
 | 
				
			||||||
@ -137,6 +145,7 @@ public class OMDbAPIController implements Runnable {
 | 
				
			|||||||
					dbController.readCache(currentTableFilm.getStreamUrl());
 | 
										dbController.readCache(currentTableFilm.getStreamUrl());
 | 
				
			||||||
				});
 | 
									});
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -206,7 +215,9 @@ public class OMDbAPIController implements Runnable {
 | 
				
			|||||||
				return movie.asObject().getString("Title", "");
 | 
									return movie.asObject().getString("Title", "");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			LOGGER.warn("Movie not found! Not adding cache!");
 | 
								// TODO set cached 1 and set the HomeFlix logo as picture
 | 
				
			||||||
 | 
					//			System.out.println("Object is: " + searchObject);
 | 
				
			||||||
 | 
								LOGGER.warn("Movie \"{}\" not found! Not adding cache!", title);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return "";
 | 
							return "";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user