TheTvDBPlugin extends ImdbPlugin { public String getBanner(Movie movie) { Banners banners = getBanners(movie.getId(THETVDB_PLUGIN_ID)); int season = movie.getSeason(); String urlBanner = null; if (textBanners && !banners.getSeriesList().isEmpty()) { urlBanner = findBannerURL2(banners, BannerType.BLANK, LANGUAGE_PRIMARY, season); if (StringTools.isNotValidString(urlBanner) && StringTools.isValidString(LANGUAGE_SECONDARY)) { urlBanner = findBannerURL2(banners, BannerType.BLANK, LANGUAGE_SECONDARY, season); } } if (!onlySeriesBanners && !banners.getSeasonList().isEmpty()) { urlBanner = findBannerURL(banners, BannerType.SEASONWIDE, LANGUAGE_PRIMARY, season); if (StringUtils.isBlank(urlBanner)) { urlBanner = findBannerURL(banners, BannerType.SEASONWIDE, LANGUAGE_SECONDARY, season); } } if (StringUtils.isBlank(urlBanner) && !banners.getSeriesList().isEmpty()) { urlBanner = findBannerURL2(banners, BannerType.GRAPHICAL, LANGUAGE_PRIMARY, season); if (StringUtils.isBlank(urlBanner)) { urlBanner = findBannerURL2(banners, BannerType.GRAPHICAL, LANGUAGE_SECONDARY, season); } } if (StringTools.isNotValidString(urlBanner)) { return Movie.UNKNOWN; } return urlBanner; } TheTvDBPlugin(); @Override String getPluginID(); @Override boolean scan(Movie movie); String getBanner(Movie movie); @Override void scanTVShowTitles(Movie movie); @Override boolean scanNFO(String nfo, Movie movie); static Series getSeries(String id); static String findId(Movie movie); static Banners getBanners(String id); static final String THETVDB_PLUGIN_ID; static final String CACHE_SERIES; static final String CACHE_BANNERS; }
@Test public void testGetBanner() { LOG.info("getBanner"); Movie movie = new Movie(); movie.setId(TheTvDBPlugin.THETVDB_PLUGIN_ID, ID_BABYLON_5); String result = TVDB.getBanner(movie); assertTrue("No banner returned", result.startsWith("http: }