mirror of
https://github.com/mitb-archive/filebot
synced 2025-01-12 22:38:11 -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,34 +401,23 @@ public class Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void warmupCachedResources() {
|
private static void warmupCachedResources() {
|
||||||
Thread warmup = new Thread("warmupCachedResources") {
|
try {
|
||||||
|
// pre-load filter data
|
||||||
|
MediaDetection.getClutterFileFilter();
|
||||||
|
MediaDetection.getDiskFolderFilter();
|
||||||
|
|
||||||
@Override
|
Collection<File> empty = Collections.emptyList();
|
||||||
public void run() {
|
MediaDetection.matchSeriesByDirectMapping(empty);
|
||||||
try {
|
|
||||||
// pre-load filter data
|
|
||||||
MediaDetection.getClutterFileFilter();
|
|
||||||
MediaDetection.getDiskFolderFilter();
|
|
||||||
|
|
||||||
Collection<File> empty = Collections.emptyList();
|
// pre-load movie/series index
|
||||||
MediaDetection.matchSeriesByDirectMapping(empty);
|
List<String> dummy = Collections.singletonList("");
|
||||||
|
MediaDetection.stripReleaseInfo(dummy, true);
|
||||||
// pre-load movie/series index
|
MediaDetection.matchSeriesByName(dummy, -1, MediaDetection.getSeriesIndex());
|
||||||
List<String> dummy = Collections.singletonList("");
|
MediaDetection.matchSeriesByName(dummy, -1, MediaDetection.getAnimeIndex());
|
||||||
MediaDetection.stripReleaseInfo(dummy, true);
|
MediaDetection.matchMovieName(dummy, true, -1);
|
||||||
MediaDetection.matchSeriesByName(dummy, -1, MediaDetection.getSeriesIndex());
|
} catch (Exception e) {
|
||||||
MediaDetection.matchSeriesByName(dummy, -1, MediaDetection.getAnimeIndex());
|
Logger.getLogger(Main.class.getName()).log(Level.WARNING, e.getMessage(), e);
|
||||||
MediaDetection.matchMovieName(dummy, true, -1);
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.getLogger(getClass().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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user