Package com.vgo.movie.thread

Source Code of com.vgo.movie.thread.DetailFilmThread

package com.vgo.movie.thread;

import java.awt.Cursor;
import java.awt.Image;
import java.io.File;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Properties;

import javax.swing.ImageIcon;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.table.DefaultTableModel;

import org.htmlparser.Node;
import org.htmlparser.Parser;
import org.htmlparser.filters.NodeClassFilter;
import org.htmlparser.tags.Div;
import org.htmlparser.tags.LinkTag;
import org.htmlparser.tags.TitleTag;
import org.htmlparser.util.NodeList;
import org.htmlparser.util.ParserException;

import com.vgo.movie.data.DatabaseDAO;
import com.vgo.movie.domain.Acteurs;
import com.vgo.movie.domain.Generique;
import com.vgo.movie.ecran.DetailFilm;
import com.vgo.movie.util.FileDownload;
import com.vgo.movie.util.Libelle;

public class DetailFilmThread extends Thread{

  DetailFilm localParent = null;
  String urlFilm = null;
  Image logoImdb = null;

  public DetailFilmThread(DetailFilm parent){
    localParent = parent;
  }


  public void initialize() {
    this.start();
  }

  public void run() {
   
    localParent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    try {
      Generique tmp = new Generique();
      tmp.setId("useProxy");
      tmp = (Generique)DatabaseDAO.selectParametre(tmp);
      if(tmp.getCode().equals("O")){
        //Param�trer le proxy
        Properties systemSettings = System.getProperties();

        tmp = new Generique();
        tmp.setId("http.proxyHost");
        tmp = (Generique)DatabaseDAO.selectParametre(tmp);
        if(tmp.getCode() != null && !tmp.getCode().equals(""))
          systemSettings.put("http.proxyHost", tmp.getCode());

        tmp = new Generique();
        tmp.setId("http.proxyPort");
        tmp = (Generique)DatabaseDAO.selectParametre(tmp);
        if(tmp.getCode() != null && !tmp.getCode().equals(""))
          systemSettings.put("http.proxyPort", tmp.getCode());

        tmp = new Generique();
        tmp.setId("http.proxyUser");
        tmp = (Generique)DatabaseDAO.selectParametre(tmp);
        if(tmp.getCode() != null && !tmp.getCode().equals(""))
          systemSettings.put("http.proxyUser", tmp.getCode());       

        tmp = new Generique();
        tmp.setId("http.proxyPassword");
        tmp = (Generique)DatabaseDAO.selectParametre(tmp);
        if(tmp.getCode() != null && !tmp.getCode().equals(""))
          systemSettings.put("http.proxyPassword", tmp.getCode());

        System.setProperties(systemSettings);
      }
    } catch (SQLException e) {
      JOptionPane.showOptionDialog(
          SwingUtilities.getWindowAncestor(localParent),
          Libelle.getLibelle("erreurRecuperationParametre"),
          Libelle.getLibelle("erreur"),
          JOptionPane.DEFAULT_OPTION,
          JOptionPane.ERROR_MESSAGE,
          null,
          null,
          null);
    }   

    localParent.getJProgressBar().setMaximum(200);
    localParent.getJProgressBar().setValue(10);
    try {
      trouverLiens();
    } catch (Exception e) {
      JOptionPane.showOptionDialog(
          SwingUtilities.getWindowAncestor(localParent),
          Libelle.getLibelle("erreurConnexion"),
          Libelle.getLibelle("erreur"),
          JOptionPane.DEFAULT_OPTION,
          JOptionPane.ERROR_MESSAGE,
          null,
          null,
          null);
    }
    localParent.getJProgressBar().setValue(20);

    if(urlFilm != null){

      File tmpCacheDir = new File(".cacheMovieDbSl");

      if(!tmpCacheDir.exists()){
        try {
          if(!tmpCacheDir.mkdirs()){
            throw new Exception();
          }
        } catch (Exception e) {
          JOptionPane.showOptionDialog(
              SwingUtilities.getWindowAncestor(localParent),
              Libelle.getLibelle("erreurCreationRepertoire"),
              Libelle.getLibelle("erreur"),
              JOptionPane.DEFAULT_OPTION,
              JOptionPane.ERROR_MESSAGE,
              null,
              null,
              null);
        }     
      }

      try {
        localParent.afficherLogoImdb(FileDownload.download("http://i.imdb.com/images/nb15/logo.gif"));
        localParent.getJProgressBar().setValue(localParent.getJProgressBar().getValue()+10);
      } catch (Exception e) {
      }

      try {
        recupererInfoFilm();
      } catch (Exception e) {
        JOptionPane.showOptionDialog(
            SwingUtilities.getWindowAncestor(localParent),
            Libelle.getLibelle("erreurConnexion"),
            Libelle.getLibelle("erreur"),
            JOptionPane.DEFAULT_OPTION,
            JOptionPane.ERROR_MESSAGE,
            null,
            null,
            null);
     

      localParent.getJProgressBar().setValue(localParent.getJProgressBar().getMaximum());

    }
    else{
      localParent.getJProgressBar().setValue(localParent.getJProgressBar().getMaximum());
    }
   
    localParent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

 

  private void trouverLiens() throws Exception{
    Parser parser;
    NodeList listUrlNode;
    NodeList listTitleNode;
    String tmpString;
    String tmpLien;
    String tmpValeur;
    LinkedList<HashMap> listUrl = new LinkedList<HashMap>();
    HashMap<String, String> tmpHashMap;
    String tmpRecherche;
    int i=0;

    try {
      tmpRecherche = "http://www.imdb.com/find?s=tt&q=" + localParent.getJValeurNom().getText().replaceAll(" ", "+");

      parser = new Parser(tmpRecherche);

      listTitleNode = parser.extractAllNodesThatMatch(new NodeClassFilter (TitleTag.class));
      //On commence par d�tecter le titre
      for(i = 0;i < listTitleNode.size(); i++){
        tmpString = listTitleNode.elementAt(i).toHtml();
        if(tmpString.indexOf("IMDb Title  Search") <= -1){
          urlFilm = tmpRecherche;
        }
      }

      if(urlFilm == null){
        parser.reset();
        parser.setResource(tmpRecherche);       
        listUrlNode = parser.extractAllNodesThatMatch (new NodeClassFilter (LinkTag.class));
        //On d�tecte d'abord les liens
        for (i = 0; i < listUrlNode.size(); i++){
          tmpString = listUrlNode.elementAt(i).toHtml();
          tmpLien = tmpString.substring(tmpString.indexOf("<a href=")+9, tmpString.indexOf(">")-1);
          if(tmpLien.startsWith("/title/")){
            tmpValeur = replaceHtmlCode(tmpString.substring(tmpString.indexOf(">")+1, tmpString.indexOf("</a>")));       
            tmpHashMap = new HashMap<String, String>();

            tmpHashMap.put("Nom",tmpValeur);
            tmpHashMap.put("URL",new String("http://www.imdb.com" + tmpLien));

            listUrl.add(tmpHashMap);
          }
        }


        Object[] message = new Object[2];
        message[0] = Libelle.getLibelle("choisirFilm");

        JComboBox cb = new JComboBox();

        for (HashMap<String,String> hashMap : listUrl) {
          cb.addItem(hashMap.get("Nom"));
        }   
        message[1] = cb;

        // Options
        String[] options = { Libelle.getLibelle("ok")};
        JOptionPane.showOptionDialog(
            localParent,                               // the parent that the dialog blocks
            message,                                    // the dialog message array
            Libelle.getLibelle("choisirFilm"),       // the title of the dialog window
            JOptionPane.DEFAULT_OPTION,                 // option type
            JOptionPane.INFORMATION_MESSAGE,            // message type
            null,                                       // optional icon, use null to use the default icon
            options,                                    // options string array, will be made into buttons
            options[0]                                  // option that should be made into a default button
        );

        cb = (JComboBox)message[1];       
        urlFilm = (String)((HashMap)(listUrl.get(cb.getSelectedIndex()))).get("URL");       
      }

    }
    catch (ParserException e)
    {
      throw e;
   

  }

  private void recupererInfoFilm() throws Exception{
    Parser divParser;
    NodeList listDiv;
    Node tmpNode; 

    boolean acteursVu = false;
    boolean titreVu = false;
    boolean realisateurVu = false;
    boolean paysVu = false;
    boolean tempsVu = false;
    boolean genreVu = false;
    boolean awardsVu = false;
    boolean dateSortieVue = false;
    boolean imageVues = false;
    int indexDeb = 0;
    int indexFin = 0;


    try{
      divParser = new Parser(urlFilm);
      listDiv = divParser.extractAllNodesThatMatch (new NodeClassFilter (Div.class));
      for (int i = 0; i < listDiv.size(); i++){
        NodeList tmpDivNodeContent = listDiv.elementAt(i).getChildren();

        if(tmpDivNodeContent != null){
          for(int j = 0; j< tmpDivNodeContent.size(); j++){
            tmpNode = tmpDivNodeContent.elementAt(j);

            if(tmpNode.toHtml().indexOf("alt=\"Cast\"") > -1 && !acteursVu){
              LinkedList<Acteurs> tmpListActeur = new LinkedList<Acteurs>();
              Acteurs tmpActeur = null;

              String tmpContenu = tmpNode.toHtml().toString();
              if(tmpContenu.indexOf("<table class=\"cast\">") >-1 && tmpContenu.indexOf("<table class=\"cast\">") < tmpContenu.indexOf("</table>",tmpContenu.indexOf("<table class=\"cast\">"))){
                tmpContenu = tmpContenu.substring(tmpContenu.indexOf("<table class=\"cast\">"),tmpContenu.indexOf("</table>",tmpContenu.indexOf("<table class=\"cast\">")));
                String tmpLigne = null;
                indexDeb = 0;
                indexFin = 0;

                while(tmpContenu.indexOf("<tr class=\"odd\">") > -1 || tmpContenu.indexOf("<tr class=\"even\">") > -1){
                  indexDeb = tmpContenu.indexOf("<tr class=");
                  indexFin = tmpContenu.indexOf("</tr>", indexDeb+3)+5;

                  tmpLigne = tmpContenu.substring(indexDeb, indexFin);
                  tmpActeur = new Acteurs();

                  try {
                    indexDeb = tmpLigne.indexOf("<img src=\"") + 10 ;
                    indexFin = tmpLigne.indexOf("\"", indexDeb);                 
                    tmpActeur.setImage(tmpLigne.substring(indexDeb, indexFin));                 

                    indexDeb = tmpLigne.indexOf("\">",tmpLigne.indexOf("<td class=\"nm\"><a href=\"")+18) + 2;
                    indexFin = tmpLigne.indexOf("</a></td>", indexDeb);                 
                    tmpActeur.setActeur(replaceHtmlCode(tmpLigne.substring(indexDeb, indexFin)));

                    indexDeb = tmpLigne.indexOf("<td class=\"char\">")+ 17;
                    indexFin = tmpLigne.indexOf("</td>", indexDeb);                 
                    tmpActeur.setPersonnage(replaceHtmlCode(tmpLigne.substring(indexDeb, indexFin)));

                    tmpListActeur.add(tmpActeur);
                  } catch (IndexOutOfBoundsException e) {
                    //do nothing
                  }             
                  tmpContenu =  tmpContenu.substring(indexFin);
                  indexDeb = 0;
                  indexFin = 0;
                }
              }
              localParent.getJProgressBar().setValue(localParent.getJProgressBar().getValue()+20);

              int facteur = 20 / tmpListActeur.size();

              for (Acteurs tmpActeur2 : tmpListActeur) {
                Object[] data = {new ImageIcon(FileDownload.download(tmpActeur2.getImage())),
                    tmpActeur2.getActeur(),
                    tmpActeur2.getPersonnage()};
                ((DefaultTableModel)localParent.getJTableActeurs().getModel()).addRow(data);
                localParent.getJProgressBar().setValue(localParent.getJProgressBar().getValue()+facteur);
              }
              acteursVu = true;
            }

            if(tmpNode.toHtml().toString().startsWith("<div id=\"tn15crumbs\">") && !titreVu){
              /*Titre du Film*/
              String tmpContenu = tmpNode.toHtml().toString();
              if(tmpContenu.indexOf("<b>") >= 0){
                localParent.setValeurNomIdmb(replaceHtmlCode(tmpContenu.substring(tmpContenu.indexOf("<b>")+3,tmpContenu.indexOf("</b>"))));
                localParent.getJProgressBar().setValue(localParent.getJProgressBar().getValue()+10);
              }
              titreVu = true;
            }

            if (tmpNode.toHtml().toString().indexOf("Director:") > -1 && tmpNode.toHtml().toString().startsWith("<div class=\"info\">") && !realisateurVu){
              localParent.setValeurRealisateur(extractValeur(tmpNode.toHtml()));
              localParent.getJProgressBar().setValue(localParent.getJProgressBar().getValue()+10);
              realisateurVu = true;
            }
            if (tmpNode.toHtml().toString().indexOf("Country:") > -1 && tmpNode.toHtml().toString().startsWith("<div class=\"info\">") && !paysVu){
              localParent.setValeurPays(extractValeur(tmpNode.toHtml()));
              localParent.getJProgressBar().setValue(localParent.getJProgressBar().getValue()+10);
              paysVu = true;
            }
            if (tmpNode.toHtml().toString().indexOf("Runtime:") > -1 && tmpNode.toHtml().toString().startsWith("<div class=\"info\">") && !tempsVu){
              localParent.setValeurDuree(extractValeur(tmpNode.toHtml()));
              localParent.getJProgressBar().setValue(localParent.getJProgressBar().getValue()+10);
              tempsVu = true;
            }
            if (tmpNode.toHtml().toString().indexOf("Genre:") > -1 && tmpNode.toHtml().toString().startsWith("<div class=\"info\">") && !genreVu){
              localParent.setValeurGenre(extractValeur(tmpNode.toHtml()));
              localParent.getJProgressBar().setValue(localParent.getJProgressBar().getValue()+10);
              genreVu = true;
            }
            if (tmpNode.toHtml().toString().indexOf("Awards:") > -1 && tmpNode.toHtml().toString().startsWith("<div class=\"info\">") && !awardsVu){
              localParent.setValeurRecompenses(extractValeur(tmpNode.toHtml()));
              localParent.getJProgressBar().setValue(localParent.getJProgressBar().getValue()+10);
              awardsVu = true;
            }           
            if (tmpNode.toHtml().toString().indexOf("Release Date:") > -1 && tmpNode.toHtml().toString().startsWith("<div class=\"info\">") && !dateSortieVue){
              localParent.setValeurDateSortie(extractValeur(tmpNode.toHtml()));
              localParent.getJProgressBar().setValue(localParent.getJProgressBar().getValue()+10);
              dateSortieVue = true;
            }       
            if (tmpNode.toHtml().toString().startsWith("<div id=\"tn15recent\">") && !imageVues){
              /* Les Photos */
              String tmpContenu = tmpNode.toHtml().toString();

              int numImage = 0;
              indexDeb = 0;
              indexFin = 0;

              while (tmpContenu.indexOf("<img src=\"http://i.") >=0 && numImage <= 3){
                indexDeb = tmpContenu.toLowerCase().indexOf("<img src=\"http://i.") + 10;
                indexFin = tmpContenu.toLowerCase().indexOf("\"", indexDeb);

                String tmpImage = tmpContenu.substring(indexDeb, indexFin);
                tmpContenu = tmpContenu.replaceAll(tmpImage, "");


                if(tmpImage.endsWith(".jpg")){
                  numImage++;
                  if(numImage == 1){

                    localParent.afficherImage1(FileDownload.download(tmpImage));
                    localParent.getJProgressBar().setValue(localParent.getJProgressBar().getValue()+10);
                  }
                  if(numImage == 2){
                    localParent.afficherImage2(FileDownload.download(tmpImage));
                    localParent.getJProgressBar().setValue(localParent.getJProgressBar().getValue()+10);
                  }
                  if(numImage == 3){
                    localParent.afficherImage3(FileDownload.download(tmpImage));
                    localParent.getJProgressBar().setValue(localParent.getJProgressBar().getValue()+10);
                  }                   
                }         
              }
              imageVues = true;
            }                   
            tmpNode = null;
          }         
        }

      }     

    }
    catch (ParserException e){
      throw e;
    }
  }

  private String extractValeur(String div){
    String retour = new String();
    String tmpString;
    int begin;
    int end;


    /*On extrait tout le contenu en </H5> et </DIV>*/
    begin = div.toLowerCase().indexOf("</h5>") + "</h5>".length();
    end = div.toLowerCase().lastIndexOf("</div>");
    if(begin > -1 && end >= begin){
      tmpString = div.substring(begin, end);

      retour = tmpString.replaceAll("\n", "");

      /*Nettoyage des balises HTML*/
      while(retour.indexOf("<") > -1){
        begin = retour.indexOf("<");
        end = retour.indexOf(">", begin);
        retour = retour.replaceAll(retour.substring(begin, end+1), "");
      }
    }

    retour = retour.trim();

    if(retour.endsWith("more")){
      retour = retour.substring(0, retour.lastIndexOf("more"));
    }

    return replaceHtmlCode(retour);
  }


  private String replaceHtmlCode(String input){
    String output = input;

    output = output.replaceAll("&#34; ", "\"");
    output = output.replaceAll("&#38; ", "&" );
    output = output.replaceAll("&#128;", "�" );
    output = output.replaceAll("&#129;", "?" );
    output = output.replaceAll("&#130;", "�" );
    output = output.replaceAll("&#131;", "�" );
    output = output.replaceAll("&#132;", "�" );
    output = output.replaceAll("&#133;", "�" );
    output = output.replaceAll("&#134;", "�" );
    output = output.replaceAll("&#135;", "�" );
    output = output.replaceAll("&#136;", "�" );
    output = output.replaceAll("&#137;", "�" );
    output = output.replaceAll("&#138;", "�" );
    output = output.replaceAll("&#139;", "�" );
    output = output.replaceAll("&#140;", "�" );
    output = output.replaceAll("&#141;", "?" );
    output = output.replaceAll("&#142;", "�" );
    output = output.replaceAll("&#143;", "?" );
    output = output.replaceAll("&#144;", "?" );
    output = output.replaceAll("&#145;", "�" );
    output = output.replaceAll("&#146;", "�" );
    output = output.replaceAll("&#147;", "�" );
    output = output.replaceAll("&#148;", "�" );
    output = output.replaceAll("&#149;", "�" );
    output = output.replaceAll("&#150;", "�" );
    output = output.replaceAll("&#151;", "�" );
    output = output.replaceAll("&#152;", "�" );
    output = output.replaceAll("&#153;", "�" );
    output = output.replaceAll("&#154;", "�" );
    output = output.replaceAll("&#155;", "�" );
    output = output.replaceAll("&#156;", "�" );
    output = output.replaceAll("&#157;", "?" );
    output = output.replaceAll("&#158;", "�" );
    output = output.replaceAll("&#159;", "�" );
    output = output.replaceAll("&#160;", " " );
    output = output.replaceAll("&#161;", "�" );
    output = output.replaceAll("&#162;", "�" );
    output = output.replaceAll("&#163;", "�" );
    output = output.replaceAll("&#164;", "�" );
    output = output.replaceAll("&#165;", "�" );
    output = output.replaceAll("&#166;", "�" );
    output = output.replaceAll("&#167;", "�" );
    output = output.replaceAll("&#168;", "�" );
    output = output.replaceAll("&#169;", "�" );
    output = output.replaceAll("&#170;", "�" );
    output = output.replaceAll("&#171;", "�" );
    output = output.replaceAll("&#172;", "�" );
    output = output.replaceAll("&#173;", "�" );
    output = output.replaceAll("&#174;", "�" );
    output = output.replaceAll("&#175;", "�" );
    output = output.replaceAll("&#176;", "�" );
    output = output.replaceAll("&#177;", "�" );
    output = output.replaceAll("&#178;", "�" );
    output = output.replaceAll("&#179;", "�" );
    output = output.replaceAll("&#180;", "�" );
    output = output.replaceAll("&#181;", "�" );
    output = output.replaceAll("&#182;", "�" );
    output = output.replaceAll("&#183;", "�" );
    output = output.replaceAll("&#184;", "�" );
    output = output.replaceAll("&#185;", "�" );
    output = output.replaceAll("&#186;", "�" );
    output = output.replaceAll("&#187;", "�" );
    output = output.replaceAll("&#188;", "�" );
    output = output.replaceAll("&#189;", "�" );
    output = output.replaceAll("&#190;", "�" );
    output = output.replaceAll("&#191;", "�" );
    output = output.replaceAll("&#192;", "�" );
    output = output.replaceAll("&#193;", "�" );
    output = output.replaceAll("&#194;", "�" );
    output = output.replaceAll("&#195;", "�" );
    output = output.replaceAll("&#196;", "�" );
    output = output.replaceAll("&#197;", "�" );
    output = output.replaceAll("&#198 ", "�" );
    output = output.replaceAll("&#199;", "�" );
    output = output.replaceAll("&#200;", "�" );
    output = output.replaceAll("&#201;", "�" );
    output = output.replaceAll("&#202;", "�" );
    output = output.replaceAll("&#203;", "�" );
    output = output.replaceAll("&#204;", "�" );
    output = output.replaceAll("&#205;", "�" );
    output = output.replaceAll("&#206;", "�" );
    output = output.replaceAll("&#207;", "�" );
    output = output.replaceAll("&#208;", "�" );
    output = output.replaceAll("&#209;", "�" );
    output = output.replaceAll("&#210;", "�" );
    output = output.replaceAll("&#211;", "�" );
    output = output.replaceAll("&#212;", "�" );
    output = output.replaceAll("&#213;", "�" );
    output = output.replaceAll("&#214;", "�" );
    output = output.replaceAll("&#215;", "�" );
    output = output.replaceAll("&#216;", "�" );
    output = output.replaceAll("&#217;", "�" );
    output = output.replaceAll("&#218;", "�" );
    output = output.replaceAll("&#219;", "�" );
    output = output.replaceAll("&#220;", "�" );
    output = output.replaceAll("&#221;", "�" );
    output = output.replaceAll("&#222;", "�" );
    output = output.replaceAll("&#223;", "�" );
    output = output.replaceAll("&#224;", "�" );
    output = output.replaceAll("&#225;", "�" );
    output = output.replaceAll("&#226;", "�" );
    output = output.replaceAll("&#227;", "�" );
    output = output.replaceAll("&#228;", "�" );
    output = output.replaceAll("&#229;", "�" );
    output = output.replaceAll("&#230;", "�" );
    output = output.replaceAll("&#231;", "�" );
    output = output.replaceAll("&#232;", "�" );
    output = output.replaceAll("&#233;", "�" );
    output = output.replaceAll("&#234;", "�" );
    output = output.replaceAll("&#235;", "�" );
    output = output.replaceAll("&#236;", "�" );
    output = output.replaceAll("&#237;", "�" );
    output = output.replaceAll("&#238;", "�" );
    output = output.replaceAll("&#239;", "�" );
    output = output.replaceAll("&#240;", "�" );
    output = output.replaceAll("&#241;", "�" );
    output = output.replaceAll("&#242;", "�" );
    output = output.replaceAll("&#243;", "�" );
    output = output.replaceAll("&#244;", "�" );
    output = output.replaceAll("&#245;", "�" );
    output = output.replaceAll("&#246;", "�" );
    output = output.replaceAll("&#247;", "�" );
    output = output.replaceAll("&#248;", "�" );
    output = output.replaceAll("&#249;", "�" );
    output = output.replaceAll("&#250;", "�" );
    output = output.replaceAll("&#251;", "�" );
    output = output.replaceAll("&#252;", "�" );
    output = output.replaceAll("&#253;", "�" );
    output = output.replaceAll("&#254;", "�" );
    output = output.replaceAll("&#255;", "�" );   
    output = output.replaceAll("&quot;", "\"");
    output = output.replaceAll("&amp;", " & " );
    output = output.replaceAll("&euro;", "�" );
    output = output.replaceAll("&lt;", "�" );
    output = output.replaceAll("&gt;", "�" );
    output = output.replaceAll("&oelig;", "�" );
    output = output.replaceAll("&Yuml;", "�" );
    output = output.replaceAll("&nbsp;", " " );
    output = output.replaceAll("&iexcl;", "�" );
    output = output.replaceAll("&cent;", "�" );
    output = output.replaceAll("&pound;", "�" );
    output = output.replaceAll("&curren;", "�" );
    output = output.replaceAll("&yen;", "�" );
    output = output.replaceAll("&brvbar;", "�" );
    output = output.replaceAll("&sect;", "�" );
    output = output.replaceAll("&uml;", "�" );
    output = output.replaceAll("&copy;", "�" );
    output = output.replaceAll("&ordf;", "�" );
    output = output.replaceAll("&laquo;", "�" );
    output = output.replaceAll("&not;", "�" );
    output = output.replaceAll("&shy;", "�" );
    output = output.replaceAll("&reg;", "�" );
    output = output.replaceAll("&masr;", "�" );
    output = output.replaceAll("&deg;", "�" );
    output = output.replaceAll("&plusmn;", "�" );
    output = output.replaceAll("&sup2;", "�" );
    output = output.replaceAll("&sup3;", "�" );
    output = output.replaceAll("&acute;", "�" );
    output = output.replaceAll("&micro;", "�" );
    output = output.replaceAll("&para;", "�" );
    output = output.replaceAll("&middot;", "�" );
    output = output.replaceAll("&cedil;", "�" );
    output = output.replaceAll("&sup1;", "�" );
    output = output.replaceAll("&ordm;", "�" );
    output = output.replaceAll("&raquo;", "�" );
    output = output.replaceAll("&frac14;", "�" );
    output = output.replaceAll("&frac12;", "�" );
    output = output.replaceAll("&frac34;", "�" );
    output = output.replaceAll("&iquest;", "�" );
    output = output.replaceAll("&Agrave;", "�" );
    output = output.replaceAll("&Aacute;", "�" );
    output = output.replaceAll("&Acirc;", "�" );
    output = output.replaceAll("&Atilde;", "�" );
    output = output.replaceAll("&Auml;", "�" );
    output = output.replaceAll("&Aring;", "�" );
    output = output.replaceAll("&Aelig;", "�" );
    output = output.replaceAll("&Ccedil;", "�" );
    output = output.replaceAll("&Egrave;", "�" );
    output = output.replaceAll("&Eacute;", "�" );
    output = output.replaceAll("&Ecirc;", "�" );
    output = output.replaceAll("&Euml;", "�" );
    output = output.replaceAll("&Igrave;", "�" );
    output = output.replaceAll("&Iacute;", "�" );
    output = output.replaceAll("&Icirc;", "�" );
    output = output.replaceAll("&Iuml;", "�" );
    output = output.replaceAll("&eth;", "�" );
    output = output.replaceAll("&Ntilde;", "�" );
    output = output.replaceAll("&Ograve;", "�" );
    output = output.replaceAll("&Oacute;", "�" );
    output = output.replaceAll("&Ocirc;", "�" );
    output = output.replaceAll("&Otilde;", "�" );
    output = output.replaceAll("&Ouml;", "�" );
    output = output.replaceAll("&times;", "�" );
    output = output.replaceAll("&Oslash;", "�" );
    output = output.replaceAll("&Ugrave;", "�" );
    output = output.replaceAll("&Uacute;", "�" );
    output = output.replaceAll("&Ucirc;", "�" );
    output = output.replaceAll("&Uuml;", "�" );
    output = output.replaceAll("&Yacute;", "�" );
    output = output.replaceAll("&thorn;", "�" );
    output = output.replaceAll("&szlig;", "�" );
    output = output.replaceAll("&agrave;", "�" );
    output = output.replaceAll("&aacute;", "�" );
    output = output.replaceAll("&acirc;", "�" );
    output = output.replaceAll("&atilde;", "�" );
    output = output.replaceAll("&auml;", "�" );
    output = output.replaceAll("&aring;", "�" );
    output = output.replaceAll("&aelig;", "�" );
    output = output.replaceAll("&ccedil;", "�" );
    output = output.replaceAll("&egrave;", "�" );
    output = output.replaceAll("&eacute;", "�" );
    output = output.replaceAll("&ecirc;", "�" );
    output = output.replaceAll("&euml;", "�" );
    output = output.replaceAll("&igrave;", "�" );
    output = output.replaceAll("&iacute;", "�" );
    output = output.replaceAll("&icirc;", "�" );
    output = output.replaceAll("&iuml;", "�" );
    output = output.replaceAll("&eth;", "�" );
    output = output.replaceAll("&ntilde;", "�" );
    output = output.replaceAll("&ograve;", "�" );
    output = output.replaceAll("&oacute;", "�" );
    output = output.replaceAll("&ocirc;", "�" );
    output = output.replaceAll("&otilde;", "�" );
    output = output.replaceAll("&ouml;", "�" );
    output = output.replaceAll("&divide;", "�" );
    output = output.replaceAll("&oslash;", "�" );
    output = output.replaceAll("&ugrave;", "�" );
    output = output.replaceAll("&uacute;", "�" );
    output = output.replaceAll("&ucirc;", "�" );
    output = output.replaceAll("&uuml;", "�" );
    output = output.replaceAll("&yacute;", "�" );
    output = output.replaceAll("&thorn;", "�" );
    output = output.replaceAll("&yuml;", "�" );   
    return output;
  }
}
TOP

Related Classes of com.vgo.movie.thread.DetailFilmThread

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.