/* This file is part of DrFTPD, Distributed FTP Daemon. * * Auteur : k2r * Email : k2r.contact@gmail.com * */ package net.k2rmods.plugins.irc.imdb; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; import java.io.Serializable; public class NFOFile implements Serializable { private static final long serialVersionUID = 1L; protected String url; private boolean find = false; public NFOFile(BufferedReader in) { try { String ligne; while ((ligne = in.readLine()) != null) { //System.out.println("URL DEBUG LINE : "+ligne); if (ligne.length() == 0) continue; if (ligne.charAt(0) == ';') continue; if (ligne.indexOf("imdb.com/title/") != -1 || ligne.indexOf("german.imdb.com/title/") != -1) { String[] tmp = ligne.split(" "); for(int i = 0; i < tmp.length; i++ ) { if(tmp[i].indexOf("imdb") != -1 || tmp[i].indexOf("german.imdb") != -1) { url = tmp[i]; find = true; break; } } } if (ligne.indexOf("http://") != -1) { String[] tmp = ligne.split(" "); for(int i = 0; i < tmp.length; i++ ) { if(tmp[i].indexOf("http://") != -1) { url = tmp[i]; } } } if(find == true) break; } } catch (FileNotFoundException e) { e.printStackTrace();} catch (IOException e1) {e1.printStackTrace();} } public void ToDisplay() { System.out.println("URL : " + url); } public String getURL() { return url; } }