FilmwebPlugin extends ImdbPlugin { @Override public boolean scanNFO(String nfo, Movie movie) { super.scanNFO(nfo, movie); if (StringTools.isValidString(movie.getId(FILMWEB_PLUGIN_ID))) { return Boolean.TRUE; } LOG.debug("Scanning NFO for filmweb url"); Matcher m = NFO_PATTERN.matcher(nfo); while (m.find()) { String url = m.group(); if (!StringUtils.endsWithAny(url, new String[]{".jpg", ".jpeg", ".gif", ".png", ".bmp"})) { movie.setId(FILMWEB_PLUGIN_ID, url); LOG.debug("Filmweb url found in NFO = {}", url); return Boolean.TRUE; } } LOG.debug("No filmweb url found in NFO"); return Boolean.FALSE; } FilmwebPlugin(); @Override String getPluginID(); final void init(); String getMovieId(Movie movie); String getMovieId(String title, String year); @Override boolean scan(Movie movie); @Override void scanTVShowTitles(Movie movie); @Override boolean scanNFO(String nfo, Movie movie); static final String FILMWEB_PLUGIN_ID; }
@Test public void testScanNFONoUrl() { LOG.info("testScanNFONoUrl"); Movie movie = new Movie(); filmwebPlugin.scanNFO("", movie); assertEquals(Movie.UNKNOWN, movie.getId(FilmwebPlugin.FILMWEB_PLUGIN_ID)); }
@Test public void testScanNFO() { LOG.info("testScanNFO"); Movie movie = new Movie(); filmwebPlugin.scanNFO("txt\ntxt\nfilmweb url: http: assertEquals("http: movie = new Movie(); movie.setId(FilmwebPlugin.FILMWEB_PLUGIN_ID, Movie.UNKNOWN); filmwebPlugin.scanNFO("<url>http: assertEquals("http: movie = new Movie(); movie.setId(FilmwebPlugin.FILMWEB_PLUGIN_ID, Movie.UNKNOWN); filmwebPlugin.scanNFO("[url]http: assertEquals("http: movie = new Movie(); movie.setId(FilmwebPlugin.FILMWEB_PLUGIN_ID, Movie.UNKNOWN); filmwebPlugin.scanNFO("http: assertEquals("http: movie = new Movie(); movie.setId(FilmwebPlugin.FILMWEB_PLUGIN_ID, Movie.UNKNOWN); filmwebPlugin.scanNFO("http: assertEquals("http: movie = new Movie(); movie.setId(FilmwebPlugin.FILMWEB_PLUGIN_ID, Movie.UNKNOWN); filmwebPlugin.scanNFO("http: assertEquals("http: }
@Test public void testScanNFOWithId() { LOG.info("testScanNFOWithId"); Movie movie = new Movie(); filmwebPlugin.scanNFO("txt\ntxt\nfilmweb url: http: assertEquals("http: }
@Test public void testScanNFOWithPoster() { LOG.info("testScanNFOWithPoster"); Movie movie = new Movie(); filmwebPlugin.scanNFO("txt\ntxt\nimg: http: assertEquals(Movie.UNKNOWN, movie.getId(FilmwebPlugin.FILMWEB_PLUGIN_ID)); filmwebPlugin.scanNFO("txt\ntxt\nimg: http: assertEquals("http: }