From 1f713a3e5a46aabfc22cca8de12865efe62f4041 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 15 Mar 2013 13:50:28 +0000 Subject: [PATCH] * fix issue with processing two shows with the same name, e.g. SMASH and Smash --- .../sourceforge/filebot/cli/CmdlineOperations.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/source/net/sourceforge/filebot/cli/CmdlineOperations.java b/source/net/sourceforge/filebot/cli/CmdlineOperations.java index 2e086095..4f88bcd2 100644 --- a/source/net/sourceforge/filebot/cli/CmdlineOperations.java +++ b/source/net/sourceforge/filebot/cli/CmdlineOperations.java @@ -863,7 +863,7 @@ public class CmdlineOperations implements CmdlineInterface { public List findProbableMatches(final String query, Collection searchResults, boolean strict) { // auto-select most probable search result - Map probableMatches = new LinkedHashMap(); + List probableMatches = new ArrayList(); // use name similarity metric final SimilarityMetric metric = new NameSimilarityMetric(); @@ -872,18 +872,17 @@ public class CmdlineOperations implements CmdlineInterface { for (SearchResult result : searchResults) { float f = (query == null) ? 1 : metric.getSimilarity(query, result.getName()); if (f >= (strict && searchResults.size() > 1 ? 0.85 : 0.75) || ((f >= 0.5 || !strict) && result.getName().toLowerCase().startsWith(query.toLowerCase()))) { - if (!probableMatches.containsKey(result.toString().toLowerCase())) { - probableMatches.put(result.toString().toLowerCase(), result); + if (!probableMatches.contains(result)) { + probableMatches.add(result); } } } // sort results by similarity to query - List results = new ArrayList(probableMatches.values()); if (query != null) { - sort(results, new SimilarityComparator(query)); + sort(probableMatches, new SimilarityComparator(query)); } - return results; + return probableMatches; }