diff --git a/source/net/sourceforge/filebot/web/IMDbClient.java b/source/net/sourceforge/filebot/web/IMDbClient.java index e3b7d3b0..b6cbb1bf 100644 --- a/source/net/sourceforge/filebot/web/IMDbClient.java +++ b/source/net/sourceforge/filebot/web/IMDbClient.java @@ -85,7 +85,7 @@ public class IMDbClient implements MovieIdentificationService { if (name.startsWith("\"")) continue; - String year = node.getNextSibling().getTextContent().replaceAll("[\\p{Punct}\\p{Space}]+", ""); // remove non-number characters + String year = node.getNextSibling().getTextContent().trim().replaceFirst("^\\(I\\)", "").replaceAll("[\\p{Punct}\\p{Space}]+", ""); // remove non-number characters String href = getAttribute("href", node); results.add(new Movie(name, Integer.parseInt(year), getImdbId(href), -1)); diff --git a/test/net/sourceforge/filebot/web/IMDbClientTest.java b/test/net/sourceforge/filebot/web/IMDbClientTest.java index 739d6d55..e0be9188 100644 --- a/test/net/sourceforge/filebot/web/IMDbClientTest.java +++ b/test/net/sourceforge/filebot/web/IMDbClientTest.java @@ -70,6 +70,17 @@ public class IMDbClientTest { } + @Test + public void searchMovie6() throws Exception { + List results = imdb.searchMovie("Drive 2011", null); + Movie movie = results.get(0); + + assertEquals("Drive", movie.getName()); + assertEquals(2011, movie.getYear()); + assertEquals(780504, movie.getImdbId(), 0); + } + + @Test public void searchMovieRedirect() throws Exception { List results = imdb.searchMovie("(500) Days of Summer (2009)", null);