diff --git a/source/net/sourceforge/filebot/web/IMDbClient.java b/source/net/sourceforge/filebot/web/IMDbClient.java index 9e74b955..6dfb261f 100644 --- a/source/net/sourceforge/filebot/web/IMDbClient.java +++ b/source/net/sourceforge/filebot/web/IMDbClient.java @@ -43,9 +43,6 @@ import org.xml.sax.SAXException; public class IMDbClient implements MovieIdentificationService { - private final String host = "akas.imdb.com"; - - @Override public String getName() { return "IMDb"; @@ -58,6 +55,12 @@ public class IMDbClient implements MovieIdentificationService { } + protected String getHost() { + String host = System.getProperty("imdb.hostname"); // default to akas.imdb.com but allow override via -Dimdb.host + return host == null ? "akas.imdb.com" : host; + } + + protected int getImdbId(String link) { Matcher matcher = Pattern.compile("tt(\\d{7})").matcher(link); @@ -72,7 +75,7 @@ public class IMDbClient implements MovieIdentificationService { @Override public List searchMovie(String query, Locale locale) throws Exception { - Document dom = parsePage(new URL("http", host, "/find?s=tt&q=" + encode(query))); + Document dom = parsePage(new URL("http", getHost(), "/find?s=tt&q=" + encode(query))); // select movie links followed by year in parenthesis List nodes = selectNodes("//TABLE[@class='findList']//TD/A[substring-after(substring-before(following::text(),')'),'(')]", dom); @@ -152,7 +155,7 @@ public class IMDbClient implements MovieIdentificationService { @Override public Movie getMovieDescriptor(int imdbid, Locale locale) throws Exception { try { - return scrapeMovie(parsePage(new URL("http", host, String.format("/title/tt%07d/releaseinfo", imdbid))), locale); + return scrapeMovie(parsePage(new URL("http", getHost(), String.format("/title/tt%07d/releaseinfo", imdbid))), locale); } catch (FileNotFoundException e) { return null; // illegal imdbid } diff --git a/test/net/sourceforge/filebot/web/IMDbClientTest.java b/test/net/sourceforge/filebot/web/IMDbClientTest.java index 0a1698f6..803eebd6 100644 --- a/test/net/sourceforge/filebot/web/IMDbClientTest.java +++ b/test/net/sourceforge/filebot/web/IMDbClientTest.java @@ -28,12 +28,12 @@ public class IMDbClientTest { @Test public void searchMovie2() throws Exception { - List results = imdb.searchMovie("Heat", null); + List results = imdb.searchMovie("the illusionist", null); Movie movie = results.get(0); - assertEquals("Heat", movie.getName()); - assertEquals(1995, movie.getYear()); - assertEquals(113277, movie.getImdbId(), 0); + assertEquals("The Illusionist", movie.getName()); + assertEquals(2006, movie.getYear()); + assertEquals(443543, movie.getImdbId(), 0); } diff --git a/website/scripts/utorrent-postprocess.groovy b/website/scripts/utorrent-postprocess.groovy index 05ea0a01..99afe3cd 100644 --- a/website/scripts/utorrent-postprocess.groovy +++ b/website/scripts/utorrent-postprocess.groovy @@ -79,7 +79,7 @@ input = input.findAll{ it?.exists() }.collect{ it.canonicalFile }.unique() input = input.findAll{ it.isVideo() || it.isSubtitle() || it.isDisk() } // ignore clutter files -input = input.findAll{ !(it.path =~ /\b(?i:sample|trailer|extras|deleted.scenes|music.video|scrapbook)\b/) } +input = input.findAll{ !(it.path =~ /\b(?i:sample|trailer|extras|deleted.scenes|music.video|scrapbook|behind.the.scenes)\b/) } // print input fileset input.each{ f -> _log.finest("Input: $f") }