SubBabaPosterPlugin extends AbstractMoviePosterPlugin implements ITvShowPosterPlugin { @Override public String getIdFromMovieInfo(String title, String year) { if (StringTools.isNotValidString(title)) { return Movie.UNKNOWN; } if (StringUtils.isBlank(year)) { LOG.debug("Searching for title '{}'", title); } else { LOG.debug("Searching for title '{}' with year '{}'", title, year); } try { List<SubBabaMovie> sbMovies = subBaba.searchByEnglishName(title, SearchType.ALL); if (sbMovies != null && !sbMovies.isEmpty()) { LOG.debug("Found {} movies", sbMovies.size()); for (SubBabaMovie sbm : sbMovies) { for (SubBabaContent sbContent : sbm.getContent()) { LOG.debug("SubBaba ID: {}", sbContent.getId()); return String.valueOf(sbContent.getId()); } } } } catch (SubBabaException ex) { LOG.info("No information forund for {} ({}) - error: {}", title, year, ex.getMessage(), ex); } return Movie.UNKNOWN; } SubBabaPosterPlugin(); @Override String getIdFromMovieInfo(String title, String year); @Override IImage getPosterUrl(String id); @Override IImage getPosterUrl(String title, String year); @Override String getIdFromMovieInfo(String title, String year, int tvSeason); @Override IImage getPosterUrl(String title, String year, int tvSeason); @Override IImage getPosterUrl(String id, int season); @Override String getName();  }
@Test public void testGetIdFromMovieInfo() { String idFromMovieInfo = posterPlugin.getIdFromMovieInfo(AVATAR.title, null); assertEquals(String.valueOf(AVATAR.id), idFromMovieInfo); }
@Test public void testGetIdFromMovieInfoTV() { String idFromMovieInfo = posterPlugin.getIdFromMovieInfo(PRISON_BREAK.title, null, 1); assertEquals(String.valueOf(PRISON_BREAK.id), idFromMovieInfo); }