mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-24 00:38:52 -05:00
preload data files
This commit is contained in:
parent
e119d00b52
commit
1363389b60
@ -44,6 +44,7 @@ import net.filebot.cli.ArgumentBean;
|
||||
import net.filebot.cli.ArgumentProcessor;
|
||||
import net.filebot.format.ExpressionFormat;
|
||||
import net.filebot.mac.MacAppUtilities;
|
||||
import net.filebot.media.MediaDetection;
|
||||
import net.filebot.ui.FileBotMenuBar;
|
||||
import net.filebot.ui.GettingStartedStage;
|
||||
import net.filebot.ui.MainFrame;
|
||||
@ -136,19 +137,28 @@ public class Main {
|
||||
SwingEventBus.getInstance().post(new FileTransferable(files));
|
||||
}
|
||||
|
||||
// wait for UI to startup completely before loading more classes
|
||||
Thread.sleep(2000);
|
||||
// run background tasks
|
||||
new Thread(Main::onStart).start();
|
||||
} catch (CmdLineException e) {
|
||||
// illegal arguments => print CLI error message
|
||||
System.err.println(e.getMessage());
|
||||
System.exit(1);
|
||||
} catch (Throwable e) {
|
||||
// find root cause
|
||||
while (e.getCause() != null) {
|
||||
e = e.getCause();
|
||||
}
|
||||
|
||||
// unexpected error => dump stack
|
||||
debug.log(Level.SEVERE, String.format("Error during startup: %s", e.getMessage()), e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private static void onStart() {
|
||||
// preload media.types (when loaded during DnD it will freeze the UI for a few hundred milliseconds)
|
||||
MediaTypes.getDefault();
|
||||
|
||||
// JavaFX is used for ProgressMonitor and GettingStartedDialog
|
||||
try {
|
||||
initJavaFX();
|
||||
} catch (Throwable e) {
|
||||
log.log(Level.SEVERE, "Failed to initialize JavaFX. Please install JavaFX.", e);
|
||||
}
|
||||
|
||||
// check if application help should be shown
|
||||
if (!"skip".equals(System.getProperty("application.help"))) {
|
||||
try {
|
||||
@ -166,19 +176,19 @@ public class Main {
|
||||
debug.log(Level.WARNING, "Failed to check for updates", e);
|
||||
}
|
||||
}
|
||||
} catch (CmdLineException e) {
|
||||
// illegal arguments => print CLI error message
|
||||
System.err.println(e.getMessage());
|
||||
System.exit(1);
|
||||
|
||||
// JavaFX is used for ProgressMonitor and GettingStartedDialog
|
||||
try {
|
||||
initJavaFX();
|
||||
} catch (Throwable e) {
|
||||
// find root cause
|
||||
while (e.getCause() != null) {
|
||||
e = e.getCause();
|
||||
log.log(Level.SEVERE, "Failed to initialize JavaFX. Please install JavaFX.", e);
|
||||
}
|
||||
|
||||
// unexpected error => dump stack
|
||||
debug.log(Level.SEVERE, String.format("Error during startup: %s", e.getMessage()), e);
|
||||
System.exit(1);
|
||||
// preload data files
|
||||
try {
|
||||
MediaDetection.warmupCachedResources();
|
||||
} catch (Throwable e) {
|
||||
debug.log(Level.WARNING, "Failed cache resources", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user