MovieMeterPlugin extends ImdbPlugin { @Override public boolean scan(Movie movie) { String moviemeterId = getMovieId(movie); if (!StringUtils.isNumeric(moviemeterId)) { LOG.debug("Moviemeter ID '{}' is invalid for: {} ({})", moviemeterId, movie.getTitle(), movie.getYear()); return Boolean.FALSE; } LOG.debug("Moviemeter ID available '{}', updating info", moviemeterId); return updateMediaInfo(movie, moviemeterId); } MovieMeterPlugin(); @Override String getPluginID(); @Override boolean scan(Movie movie); String getMovieId(Movie movie); String getMovieId(final String title, final String year); @Override boolean scanNFO(String nfo, Movie movie); static final String MOVIEMETER_PLUGIN_ID; }
@Test public void testScan() { LOG.info("scan"); Movie movie; for (TestData td : TEST_DATA) { movie = new Movie(); movie.setId(MovieMeterPlugin.MOVIEMETER_PLUGIN_ID, td.id); assertTrue("Failed to scan " + td.title, plugin.scan(movie)); if ("17552".equals(td.id)) { LOG.info("Testing: {}", td.toString()); assertEquals("Wrong title", td.title, movie.getTitle()); assertEquals("Wrong original title", td.title, movie.getOriginalTitle()); assertEquals("Wrong year", td.year, movie.getYear()); assertEquals("Incorrect number of countries", 2, movie.getCountries().size()); assertEquals("Wrong countries", "Verenigde Staten / Verenigd Koninkrijk", movie.getCountriesAsString()); assertTrue("No plot", StringTools.isValidString(movie.getPlot())); assertTrue("No genres", movie.getGenres().size() > 0); assertTrue("No actors", movie.getCast().size() > 0); assertTrue("No directors", movie.getDirectors().size() > 0); } } }