mirror of
https://github.com/mitb-archive/filebot
synced 2025-01-13 06:48:04 -05:00
* refactoring
This commit is contained in:
parent
47982a63f6
commit
50a92d3faa
@ -218,6 +218,7 @@ public class Main {
|
|||||||
|
|
||||||
// pre-load media.types and JNA/GIO (when loaded during DnD it will freeze the UI for a few hundred milliseconds)
|
// pre-load media.types and JNA/GIO (when loaded during DnD it will freeze the UI for a few hundred milliseconds)
|
||||||
MediaTypes.getDefault();
|
MediaTypes.getDefault();
|
||||||
|
|
||||||
if (useGVFS()) {
|
if (useGVFS()) {
|
||||||
try {
|
try {
|
||||||
GVFS.getDefaultVFS();
|
GVFS.getDefaultVFS();
|
||||||
@ -226,11 +227,6 @@ public class Main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pre-load certain resources in the background
|
|
||||||
if (Boolean.parseBoolean(System.getProperty("application.warmup"))) {
|
|
||||||
warmupCachedResources();
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for application updates (only when installed, i.e. not running via fatjar or webstart)
|
// check for application updates (only when installed, i.e. not running via fatjar or webstart)
|
||||||
if (!"skip".equals(System.getProperty("application.update"))) {
|
if (!"skip".equals(System.getProperty("application.update"))) {
|
||||||
try {
|
try {
|
||||||
@ -239,6 +235,11 @@ public class Main {
|
|||||||
Logger.getLogger(Main.class.getName()).log(Level.WARNING, "Failed to check for updates", e);
|
Logger.getLogger(Main.class.getName()).log(Level.WARNING, "Failed to check for updates", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pre-load certain resources in the background
|
||||||
|
if (Boolean.parseBoolean(System.getProperty("application.warmup"))) {
|
||||||
|
warmupCachedResources();
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// illegal arguments => just print CLI error message and stop
|
// illegal arguments => just print CLI error message and stop
|
||||||
System.err.println(e.getMessage());
|
System.err.println(e.getMessage());
|
||||||
@ -400,10 +401,6 @@ public class Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void warmupCachedResources() {
|
private static void warmupCachedResources() {
|
||||||
Thread warmup = new Thread("warmupCachedResources") {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
try {
|
||||||
// pre-load filter data
|
// pre-load filter data
|
||||||
MediaDetection.getClutterFileFilter();
|
MediaDetection.getClutterFileFilter();
|
||||||
@ -419,16 +416,9 @@ public class Main {
|
|||||||
MediaDetection.matchSeriesByName(dummy, -1, MediaDetection.getAnimeIndex());
|
MediaDetection.matchSeriesByName(dummy, -1, MediaDetection.getAnimeIndex());
|
||||||
MediaDetection.matchMovieName(dummy, true, -1);
|
MediaDetection.matchMovieName(dummy, true, -1);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.getLogger(getClass().getName()).log(Level.WARNING, e.getMessage(), e);
|
Logger.getLogger(Main.class.getName()).log(Level.WARNING, e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
// start background thread
|
|
||||||
warmup.setDaemon(true);
|
|
||||||
warmup.setPriority(Thread.MIN_PRIORITY);
|
|
||||||
warmup.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void restoreWindowBounds(final JFrame window, final Settings settings) {
|
private static void restoreWindowBounds(final JFrame window, final Settings settings) {
|
||||||
// store bounds on close
|
// store bounds on close
|
||||||
|
Loading…
Reference in New Issue
Block a user