Browse Source

minor code cleanup

dev
Jannik 3 years ago
parent
commit
e4cc195fa8
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
  1. 14
      src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java
  2. 12
      src/main/java/kellerkinder/HomeFlix/controller/DBController.java

14
src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java

@ -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");
}

12
src/main/java/kellerkinder/HomeFlix/controller/DBController.java

@ -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;

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close