TrailersLandPlugin extends TrailerPlugin { @Override public final boolean generate(Movie movie) { if (trailerMaxResolution.length() == 0) { LOG.trace("No resolution provided, skipping"); return false; } movie.setTrailerLastScan(new Date().getTime()); List<TrailersLandTrailer> trailerList = getTrailerUrls(movie); if (trailerList == null) { LOG.error("Error while scraping"); return false; } else if (trailerList.isEmpty()) { LOG.debug("No trailer found"); return false; } else { LOG.debug("Found {} trailers", trailerList.size()); } for (int i = trailerList.size() - 1; i >= 0; i--) { TrailersLandTrailer tr = trailerList.get(i); String trailerUrl = tr.getUrl(); LOG.info("Found trailer at URL {}", trailerUrl); String trailerLabel = Integer.toString(trailerList.size() - i) + "-" + tr.getLang() + "-" + tr.getType(); ExtraFile extra = new ExtraFile(); extra.setTitle("TRAILER-" + trailerLabel); if (isDownload()) { if (!downloadTrailer(movie, trailerUrl, trailerLabel, extra)) { return false; } } else { extra.setFilename(trailerUrl); movie.addExtraFile(extra); } } return true; } TrailersLandPlugin(); @Override final boolean generate(Movie movie); @Override String getName();  }
@Test public void testGenerateTitleOriginalTitle() { LOG.info("testGenerateTitleOriginalTitle"); Movie movie = new Movie(); movie.setTitle("Paradiso Amaro", Movie.UNKNOWN); movie.setOriginalTitle("The Descendants", Movie.UNKNOWN); assertTrue(tlPlugin.generate(movie)); }
@Test public void testTitle() { LOG.info("testTitle"); Movie movie = new Movie(); movie.setTitle("Operazione U.N.C.L.E.", Movie.UNKNOWN); assertTrue(tlPlugin.generate(movie)); }