* make sure to not just reasonable results, that one results is probably better than no result

This commit is contained in:
Reinhard Pointner 2014-07-09 13:20:40 +00:00
parent 0daa683cb5
commit 2841ea9552
2 changed files with 6 additions and 4 deletions

View File

@ -307,6 +307,11 @@ class MovieHashMatcher implements AutoCompleteMatcher {
} }
protected Movie selectMovie(final File movieFile, final String userQuery, final Collection<Movie> options, final Map<String, Object> memory, final Component parent) throws Exception { protected Movie selectMovie(final File movieFile, final String userQuery, final Collection<Movie> options, final Map<String, Object> memory, final Component parent) throws Exception {
// just auto-pick singleton results
if (options.size() == 1) {
return options.iterator().next();
}
// 1. movie by filename // 1. movie by filename
final String fileQuery = (userQuery != null) ? userQuery : checkedStripReleaseInfo(movieFile); final String fileQuery = (userQuery != null) ? userQuery : checkedStripReleaseInfo(movieFile);
@ -319,10 +324,6 @@ class MovieHashMatcher implements AutoCompleteMatcher {
return null; return null;
} }
if (options.size() == 1) {
return options.iterator().next();
}
// auto-select perfect match // auto-select perfect match
for (Movie movie : options) { for (Movie movie : options) {
String movieIdentifier = normalizePunctuation(movie.toString()).toLowerCase(); String movieIdentifier = normalizePunctuation(movie.toString()).toLowerCase();

View File

@ -54,6 +54,7 @@
^Download$ ^Download$
^Downloading$ ^Downloading$
^Downloads$ ^Downloads$
^Drama$
^Dropbox$ ^Dropbox$
^emule$ ^emule$
^Entertainment$ ^Entertainment$