1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-25 09:18:51 -05:00

* refactor

This commit is contained in:
Reinhard Pointner 2014-01-19 15:08:28 +00:00
parent 3ed58bda08
commit 7de1c94167
2 changed files with 23 additions and 24 deletions

View File

@ -30,9 +30,6 @@ import java.security.PermissionCollection;
import java.security.Permissions;
import java.security.Policy;
import java.security.ProtectionDomain;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Properties;
import java.util.Scanner;
@ -240,7 +237,7 @@ public class Main {
// pre-load certain resources in the background
if (Boolean.parseBoolean(System.getProperty("application.warmup"))) {
warmupCachedResources();
MediaDetection.warmupCachedResources();
}
} catch (Exception e) {
// illegal arguments => just print CLI error message and stop
@ -402,26 +399,6 @@ public class Main {
Analytics.trackEvent("GUI", "Donate", "r" + currentRev, pane.getValue() == actions[0] ? 1 : 0);
}
private static void warmupCachedResources() {
try {
// pre-load filter data
MediaDetection.getClutterFileFilter();
MediaDetection.getDiskFolderFilter();
Collection<File> empty = Collections.emptyList();
MediaDetection.matchSeriesByDirectMapping(empty);
// pre-load movie/series index
List<String> dummy = Collections.singletonList("");
MediaDetection.stripReleaseInfo(dummy, true);
MediaDetection.matchSeriesByName(dummy, -1, MediaDetection.getSeriesIndex());
MediaDetection.matchSeriesByName(dummy, -1, MediaDetection.getAnimeIndex());
MediaDetection.matchMovieName(dummy, true, -1);
} catch (Exception e) {
Logger.getLogger(Main.class.getName()).log(Level.WARNING, e.getMessage(), e);
}
}
private static void restoreWindowBounds(final JFrame window, final Settings settings) {
// store bounds on close
window.addWindowListener(new WindowAdapter() {

View File

@ -18,6 +18,7 @@ import java.text.CollationKey;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
@ -1286,4 +1287,25 @@ public class MediaDetection {
}
}
}
public static void warmupCachedResources() {
try {
// pre-load filter data
MediaDetection.getClutterFileFilter();
MediaDetection.getDiskFolderFilter();
Collection<File> empty = Collections.emptyList();
MediaDetection.matchSeriesByDirectMapping(empty);
// pre-load movie/series index
List<String> dummy = Collections.singletonList("");
MediaDetection.stripReleaseInfo(dummy, true);
MediaDetection.matchSeriesByName(dummy, -1, MediaDetection.getSeriesIndex());
MediaDetection.matchSeriesByName(dummy, -1, MediaDetection.getAnimeIndex());
MediaDetection.matchMovieName(dummy, true, -1);
} catch (Exception e) {
Logger.getLogger(MediaDetection.class.getName()).log(Level.WARNING, e.getMessage(), e);
}
}
}