* make matchMovieName CWS maxStartIndex customizable

This commit is contained in:
Reinhard Pointner 2012-07-13 06:52:20 +00:00
parent 155a487e31
commit 9e7f3618d2
2 changed files with 6 additions and 6 deletions

View File

@ -262,8 +262,8 @@ public class ApplicationStarter {
// pre-load movie/series index // pre-load movie/series index
List<String> dummy = Collections.singletonList(""); List<String> dummy = Collections.singletonList("");
MediaDetection.stripReleaseInfo(dummy, true); MediaDetection.stripReleaseInfo(dummy, true);
MediaDetection.matchSeriesByName(dummy, 0); MediaDetection.matchSeriesByName(dummy, -1);
MediaDetection.matchMovieName(dummy, true); MediaDetection.matchMovieName(dummy, true, -1);
// pre-load Groovy script engine // pre-load Groovy script engine
new ExpressionFormat("").format(""); new ExpressionFormat("").format("");

View File

@ -320,7 +320,7 @@ public class MediaDetection {
terms.add(reduceMovieName(getName(movieFolder))); terms.add(reduceMovieName(getName(movieFolder)));
} }
List<Movie> movieNameMatches = matchMovieName(terms, strict); List<Movie> movieNameMatches = matchMovieName(terms, strict, 3);
// skip further queries if collected matches are already sufficient // skip further queries if collected matches are already sufficient
if (options.size() > 0 && movieNameMatches.size() > 0) { if (options.size() > 0 && movieNameMatches.size() > 0) {
@ -330,7 +330,7 @@ public class MediaDetection {
// if matching name+year failed, try matching only by name // if matching name+year failed, try matching only by name
if (movieNameMatches.isEmpty() && strict) { if (movieNameMatches.isEmpty() && strict) {
movieNameMatches = matchMovieName(terms, false); movieNameMatches = matchMovieName(terms, false, 3);
} }
// assume name without spacing will mess up any lookup // assume name without spacing will mess up any lookup
@ -411,9 +411,9 @@ public class MediaDetection {
} }
public static List<Movie> matchMovieName(final List<String> files, final boolean strict) throws Exception { public static List<Movie> matchMovieName(final List<String> files, boolean strict, int maxStartIndex) throws Exception {
// cross-reference file / folder name with movie list // cross-reference file / folder name with movie list
final HighPerformanceMatcher nameMatcher = new HighPerformanceMatcher(3); final HighPerformanceMatcher nameMatcher = new HighPerformanceMatcher(maxStartIndex);
final Map<Movie, String> matchMap = new HashMap<Movie, String>(); final Map<Movie, String> matchMap = new HashMap<Movie, String>();
for (Entry<String, Movie> movie : getMovieIndex()) { for (Entry<String, Movie> movie : getMovieIndex()) {