ImdbPlugin implements MovieDatabasePlugin { @Override public boolean scan(Movie movie) { String imdbId = movie.getId(IMDB_PLUGIN_ID); if (isNotValidString(imdbId)) { imdbId = imdbInfo.getImdbId(movie.getTitle(), movie.getYear(), movie.isTVShow()); movie.setId(IMDB_PLUGIN_ID, imdbId); } boolean retval = Boolean.FALSE; if (isValidString(imdbId)) { retval = updateImdbMediaInfo(movie); } return retval; } ImdbPlugin(); @Override String getPluginID(); @Override boolean scan(Movie movie); @Override void scanTVShowTitles(Movie movie); @Override boolean scanNFO(String nfo, Movie movie); @Override boolean scan(Person person); static final String IMDB_PLUGIN_ID; }
@Test public void testImdbPerson() { LOG.info("testImdbPerson"); PropertiesUtil.setProperty("plugin.filmography.max", 2); ImdbPlugin imdbPlugin = new ImdbPlugin(); Person person = new Person(); person.setName("Gérard Depardieu"); assertTrue("Scan failed", imdbPlugin.scan(person)); assertEquals("Wrong person matched", "nm0000367", person.getId(ImdbPlugin.IMDB_PLUGIN_ID)); assertTrue("No bio", StringTools.isValidString(person.getBiography())); assertEquals("Wrong birth name", "Gérard Xavier Marcel Depardieu", person.getBirthName()); assertEquals("Wrong birth place", "Châteauroux, Indre, France", person.getBirthPlace()); assertFalse("No Filmography", person.getFilmography().isEmpty()); assertEquals("Wrong birthday", "27-12-1948", person.getYear()); assertTrue("No job", StringTools.isValidString(person.getFilmography().get(0).getJob())); }
@Test public void testImdbBio() { LOG.info("testImdbBio"); PropertiesUtil.setProperty("plugin.filmography.max", 2); ImdbPlugin imdbPlugin = new ImdbPlugin(); Person person = new Person(); person.setName("Adrian Edmondson"); assertTrue("Scan failed", imdbPlugin.scan(person)); assertTrue("No bio", StringTools.isValidString(person.getBiography())); }