TheTvDBPlugin extends ImdbPlugin { public static Series getSeries(String id) { Series series = (Series) CacheMemory.getFromCache(CacheMemory.generateCacheKey(CACHE_SERIES, id, LANGUAGE_PRIMARY)); if (series == null) { try { series = TVDB.getSeries(id, LANGUAGE_PRIMARY); if (series != null) { CacheMemory.addToCache(CacheMemory.generateCacheKey(CACHE_SERIES, id, LANGUAGE_PRIMARY), series); } if (series == null && !LANGUAGE_SECONDARY.isEmpty()) { series = (Series) CacheMemory.getFromCache(CacheMemory.generateCacheKey(CACHE_SERIES, id, LANGUAGE_SECONDARY)); if (series == null) { series = TVDB.getSeries(id, LANGUAGE_SECONDARY); if (series != null) { CacheMemory.addToCache(CacheMemory.generateCacheKey(CACHE_SERIES, id, LANGUAGE_SECONDARY), series); } } } } catch (Exception error) { LOG.warn("Error getting Series: {}", error.getMessage()); } } return series; } 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 testGetSeries() { LOG.info("getSeries"); Series result = TheTvDBPlugin.getSeries(String.valueOf(ID_BABYLON_5)); assertEquals("Wrong Title", "Babylon 5", result.getSeriesName()); assertTrue("No poster", StringTools.isValidString(result.getPoster())); assertTrue("No banner", StringTools.isValidString(result.getBanner())); assertTrue("No fanart", StringTools.isValidString(result.getFanart())); assertTrue("No Overview", StringTools.isValidString(result.getOverview())); assertEquals("Wrong first aired date", "1993-02-22", result.getFirstAired()); assertEquals("Wrong IMDB ID", "tt0105946", result.getImdbId()); assertFalse("No Actors", result.getActors().isEmpty()); assertFalse("No Genres", result.getGenres().isEmpty()); assertTrue("No rating", StringTools.isValidString(result.getRating())); assertEquals("Wrong runtime", "60", result.getRuntime()); }