diff --git a/source/net/sourceforge/filebot/ui/rename/EpisodeListMatcher.java b/source/net/sourceforge/filebot/ui/rename/EpisodeListMatcher.java index 278f3075..a09f6d5e 100644 --- a/source/net/sourceforge/filebot/ui/rename/EpisodeListMatcher.java +++ b/source/net/sourceforge/filebot/ui/rename/EpisodeListMatcher.java @@ -65,7 +65,7 @@ class EpisodeListMatcher implements AutoCompleteMatcher { // find probable matches using name similarity > 0.9 for (SearchResult result : searchResults) { - if (metric.getSimilarity(query, result.getName()) > 0.9) { + if (metric.getSimilarity(normalize(query), normalize(result.getName())) > 0.9) { probableMatches.add(result); } } @@ -107,6 +107,12 @@ class EpisodeListMatcher implements AutoCompleteMatcher { } + private String normalize(String value) { + // remove trailing braces, e.g. Doctor Who (2005) -> doctor who + return value.replaceAll("[(]([^)]*)[)]", "").trim().toLowerCase(); + } + + protected Set fetchEpisodeSet(Collection seriesNames, final Locale locale) throws Exception { List>> tasks = new ArrayList>>();