1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-25 01:08:52 -05:00

* non-strict mode: auto-pick first and only result even if it seems to be a bad match

This commit is contained in:
Reinhard Pointner 2012-07-09 19:13:16 +00:00
parent 4b40e02888
commit b771eb7286

View File

@ -771,10 +771,15 @@ public class CmdlineOperations implements CmdlineInterface {
}
public List<SearchResult> selectSearchResult(String query, Iterable<? extends SearchResult> searchResults, boolean strict) throws Exception {
public List<SearchResult> selectSearchResult(String query, Collection<? extends SearchResult> searchResults, boolean strict) throws Exception {
List<SearchResult> probableMatches = findProbableMatches(query, searchResults, strict);
if (probableMatches.isEmpty() || (strict && probableMatches.size() != 1)) {
// allow single search results to just pass through in non-strict mode even if match confidence is low
if (searchResults.size() == 1 && !strict) {
return new ArrayList<SearchResult>(searchResults);
}
throw new Exception("Failed to auto-select search result: " + searchResults);
}