@Override public String createSearchString(File file) { String fileBaseName; if (file.isFile()) fileBaseName = FilenameUtils.getBaseName(Movie.getUnstackedMovieName(file)); else fileBaseName = file.getName(); String[] splitBySpace = fileBaseName.split(" "); if (splitBySpace.length > 1) { // check if last word in filename contains a year like (2012) or [2012] // we want to remove this from our search because it freaks out the search on excalibur films // and gives no results if (splitBySpace[splitBySpace.length - 1].matches("[\\(\\[]\\d{4}[\\)\\]]")) { fileBaseName = fileBaseName.replaceFirst("[\\(\\[]\\d{4}[\\)\\]]", "").trim(); } } URLCodec codec = new URLCodec(); try { fileBaseName = codec.encode(fileBaseName); } catch (EncoderException e) { e.printStackTrace(); } fileBaseName = "http://www.excaliburfilms.com/search/adultSearch.htm?searchString=" + fileBaseName + "&Case=ExcalMovies&Search=AdultDVDMovies&SearchFor=Title.x"; return fileBaseName; }
// @Test public void test() { Soundex x = new Soundex(); try { int difference = x.difference("Germany", "germ"); System.out.println(difference); } catch (EncoderException e) { // TODO Auto-generated catch block e.printStackTrace(); } }