@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;
 }
Exemple #2
0
 /**
  * @throws RuntimeException Thrown if URL encoding is unsuccessful. This only happens in the case
  *     of a UnsupportedEncodingException which should never occur in reality.
  */
 public static String encodeURL(String url) {
   try {
     return urlCodec.encode(url);
   } catch (EncoderException exp) {
     //            NLogger.error( URLCodecUtils.class, exp, exp );
     throw new RuntimeException(exp.toString() + ": " + exp.getMessage());
   }
 }
  // @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();
    }
  }