Ejemplo n.º 1
0
            public void Parse(string strTable)
            {
                string   strTag         = "";
                HTMLUtil util           = new HTMLUtil();
                int      iPosEnd        = (int)strTable.Length + 1;
                int      iTableRowStart = 0;

                do
                {
                    iTableRowStart = util.FindTag(strTable, "<td", ref strTag, iTableRowStart);
                    if (iTableRowStart >= 0)
                    {
                        iTableRowStart += (int)strTag.Length;
                        int iTableRowEnd = util.FindClosingTag(strTable, "td", ref strTag, iTableRowStart) - 1;
                        if (iTableRowEnd < -1)
                        {
                            break;
                        }

                        string strRow = strTable.Substring(iTableRowStart, 1 + iTableRowEnd - iTableRowStart);
                        m_colums.Add(strRow);
                        //OutputDebugString(strRow.c_str());
                        //OutputDebugString("\n");
                        iTableRowStart = iTableRowEnd + 1;
                    }
                } while (iTableRowStart >= 0);
            }
Ejemplo n.º 2
0
        public void Parse(string strHTML)
        {
            m_rows.Clear();
            HTMLUtil util      = new HTMLUtil();
            string   strTag    = "";
            int      iPosStart = util.FindTag(strHTML, "<table", ref strTag, 0);

            if (iPosStart >= 0)
            {
                iPosStart += (int)strTag.Length;
                int iPosEnd = util.FindClosingTag(strHTML, "table", ref strTag, iPosStart) - 1;
                if (iPosEnd < 0)
                {
                    iPosEnd = (int)strHTML.Length;
                }

                string strTable       = strHTML.Substring(iPosStart, 1 + iPosEnd - iPosStart);
                int    iTableRowStart = 0;
                do
                {
                    iTableRowStart = util.FindTag(strTable, "<tr", ref strTag, iTableRowStart);
                    if (iTableRowStart >= 0)
                    {
                        iTableRowStart += (int)strTag.Length;
                        int iTableRowEnd = util.FindClosingTag(strTable, "tr", ref strTag, iTableRowStart) - 1;
                        if (iTableRowEnd < 0)
                        {
                            break;
                        }
                        string  strRow = strTable.Substring(iTableRowStart, 1 + iTableRowEnd - iTableRowStart);
                        HTMLRow row    = new HTMLRow();
                        row.Parse(strRow);
                        m_rows.Add(row);
                        iTableRowStart = iTableRowEnd + 1;
                    }
                } while (iTableRowStart >= 0);
            }
        }
Ejemplo n.º 3
0
      public void Parse(string strTable)
      {
        string strTag = "";
        HTMLUtil util = new HTMLUtil();
        int iPosEnd = (int)strTable.Length + 1;
        int iTableRowStart = 0;
        do
        {
          iTableRowStart = util.FindTag(strTable, "<td", ref strTag, iTableRowStart);
          if (iTableRowStart >= 0)
          {
            iTableRowStart += (int)strTag.Length;
            int iTableRowEnd = util.FindClosingTag(strTable, "td", ref strTag, iTableRowStart) - 1;
            if (iTableRowEnd < -1)
              break;

            string strRow = strTable.Substring(iTableRowStart, 1 + iTableRowEnd - iTableRowStart);
            m_colums.Add(strRow);
            //OutputDebugString(strRow.c_str());
            //OutputDebugString("\n");
            iTableRowStart = iTableRowEnd + 1;
          }
        } while (iTableRowStart >= 0);
      }
Ejemplo n.º 4
0
    // Filmograpy and bio
    public bool GetActorDetails(IMDBUrl url, out IMDBActor actor)
    {
      actor = new IMDBActor();

      string[] vdbParserStr = VdbParserStringActorDetails();

      if (vdbParserStr == null || vdbParserStr.Length != 46)
      {
        return false;
      }

      try
      {
        string absoluteUri;
        string strBody = GetPage(url.URL, "utf-8", out absoluteUri);
        
        if (strBody == null)
        {
          return false;
        }
        
        if (strBody.Length == 0)
        {
          return false;
        }
        
        #region Actor imdb id

        // IMDBActorID
        try
        {
          int pos = url.URL.LastIndexOf("nm");
          string id = url.URL.Substring(pos, 9).Replace("/", string.Empty);
          actor.IMDBActorID = id;
        }
        catch (Exception) { }

        #endregion

        HTMLParser parser = new HTMLParser(strBody);
        string strThumb = string.Empty;
        string value = string.Empty;
        string value2 = string.Empty;
        
        #region Actor name

        // Actor name
        if ((parser.skipToEndOf(vdbParserStr[0])) &&        // <title>
            (parser.extractTo(vdbParserStr[1], ref value))) // - IMDb</title>
        {
          value = new HTMLUtil().ConvertHTMLToAnsi(value);
          value = Util.Utils.RemoveParenthesis(value).Trim();
          actor.Name = HttpUtility.HtmlDecode(value.Trim());
        }
        
        if (actor.Name == string.Empty)
        {
          actor.Name = url.Title;
        }

        #endregion

        // Photo
        string parserTxt = parser.Content;
        string photoBlock = string.Empty;

        #region Actor photo

        if (parser.skipToStartOf(vdbParserStr[2]) &&              // <td id="img_primary"
            (parser.extractTo(vdbParserStr[3], ref photoBlock)))  // </td>
        {
          parser.Content = photoBlock;
        
          if ((parser.skipToEndOf(vdbParserStr[4])) &&            // <img src="
              (parser.extractTo(vdbParserStr[5], ref strThumb)))  // "
          {
            actor.ThumbnailUrl = strThumb;
          }
          parser.Content = parserTxt;
        }
        
        #endregion

        #region Actor birth date

        // Birth date
        if ((parser.skipToEndOf(vdbParserStr[6])) &&          // >Born:</h4>
            (parser.skipToEndOf(vdbParserStr[7])) &&          // birth_monthday=
            (parser.skipToEndOf(vdbParserStr[8])) &&          // >
            (parser.extractTo(vdbParserStr[9], ref value)) && // <
            (parser.skipToEndOf(vdbParserStr[10])) &&         // year=
            (parser.extractTo(vdbParserStr[11], ref value2))) // "

        {
          actor.DateOfBirth = value + " " + value2;
        }

        #endregion

        #region Actor death date

        // Death date
        if ((parser.skipToEndOf(vdbParserStr[12])) &&           // >Died:</h4>
            (parser.skipToEndOf(vdbParserStr[13])) &&           // death_monthday="
            (parser.skipToEndOf(vdbParserStr[14])) &&           // >
            (parser.extractTo(vdbParserStr[15], ref value)) &&  // <
            (parser.skipToEndOf(vdbParserStr[16])) &&           // death_date="
            (parser.extractTo(vdbParserStr[17], ref value2)))   // "
        {
          actor.DateOfDeath = value + " " + value2;
        }

        #endregion

        parser.resetPosition();

        #region Actor birth place

        // Birth place
        if ((parser.skipToEndOf(vdbParserStr[18])) &&         // birth_place=
            (parser.skipToEndOf(vdbParserStr[19])) &&         // >
            (parser.extractTo(vdbParserStr[20], ref value)))  // <
        {
          actor.PlaceOfBirth = HttpUtility.HtmlDecode(value);
        }

        #endregion

        #region Actor death place

        // Death place
        if ((parser.skipToEndOf(vdbParserStr[21])) &&         // death_place=
            (parser.skipToEndOf(vdbParserStr[22])) &&         // >
            (parser.extractTo(vdbParserStr[23], ref value)))  // <
        {
          actor.PlaceOfDeath = HttpUtility.HtmlDecode(value);
        }

        #endregion

        //Mini Biography
        parser.resetPosition();

        #region Actor biography

        if ((parser.skipToEndOf(vdbParserStr[24])) &&         // <td id="overview-top">
            (parser.skipToEndOf(vdbParserStr[25])) &&         // <p>
            (parser.extractTo(vdbParserStr[26], ref value)))  // See full bio</a>
        {
          value = new HTMLUtil().ConvertHTMLToAnsi(value);
          actor.MiniBiography = Util.Utils.stripHTMLtags(value);
          actor.MiniBiography = actor.MiniBiography.Replace(vdbParserStr[45], string.Empty).Trim(); // See full bio »
          actor.MiniBiography = HttpUtility.HtmlDecode(actor.MiniBiography); // Remove HTML entities like &#189;
          
          if (actor.MiniBiography != string.Empty)
          {
            // get complete biography
            string bioURL = absoluteUri;
            
            if (!bioURL.EndsWith(vdbParserStr[27])) // /
            {
              bioURL += vdbParserStr[28];           // /bio
            }
            else
            {
              bioURL += vdbParserStr[29];           // bio
            }

            string strBioBody = GetPage(bioURL, "utf-8", out absoluteUri);
            
            if (!string.IsNullOrEmpty(strBioBody))
            {
              HTMLParser parser1 = new HTMLParser(strBioBody);

              if (parser1.skipToEndOf(vdbParserStr[30]) &&        // <h5>Mini Biography</h5>
                  parser1.skipToEndOf(vdbParserStr[31]) &&        // <div class="wikipedia_bio">
                  parser1.extractTo(vdbParserStr[32], ref value)) // </div>
              {
                value = new HTMLUtil().ConvertHTMLToAnsi(value);
                value = Regex.Replace(value, @"</h5>\s<h5>", "\n\r");
                value = Regex.Replace(value, @"<h5>", "\n\r\n\r");
                value = Regex.Replace(value, @"</h5>", ":\n\r");
                actor.Biography = Util.Utils.stripHTMLtags(value).Trim();
                actor.Biography = HttpUtility.HtmlDecode(actor.Biography);
              }
              else
              {
                parser1.resetPosition();
                
                if (parser1.skipToEndOf(vdbParserStr[33]) &&      // <h5>Mini Biography</h5>
                  parser1.extractTo(vdbParserStr[34], ref value)) // </p>
                {
                  value = new HTMLUtil().ConvertHTMLToAnsi(value);
                  actor.Biography = Util.Utils.stripHTMLtags(value).Trim();
                  actor.Biography = HttpUtility.HtmlDecode(actor.Biography);
                }
              }
            }
          }
        }

        #endregion

        // Person is movie director or an actor/actress
        bool isActorPass = false;
        bool isDirectorPass = false;
        bool isWriterPass = false;
        
        parser.resetPosition();

        HTMLParser dirParser = new HTMLParser(); // HTML body for Director
        HTMLParser wriParser = new HTMLParser(); // HTML body for Writers

        #region Check person role in movie (actor, director or writer)

        if ((parser.skipToEndOf(vdbParserStr[35])) && // name="Director">Director</a>
            (parser.skipToEndOf(vdbParserStr[36])))   // </div>
        {
          isDirectorPass = true;
          dirParser.Content = parser.Content;
        }
        
        parser.resetPosition();

        if ((parser.skipToEndOf(vdbParserStr[37])) && // name="Writer">Writer</a>
            (parser.skipToEndOf(vdbParserStr[38])))   // </div>
        {
          isWriterPass = true;
          wriParser.Content = parser.Content;
        }

        parser.resetPosition();

        if (parser.skipToEndOf(vdbParserStr[39]) || // name="Actress">Actress</a>
          parser.skipToEndOf(vdbParserStr[40]))     // name="Actor">Actor</a>
        {
          isActorPass = true;
        }

        #endregion

        #region Get movies for every role

        // Get filmography Actor
        if (isActorPass)
        {
          GetActorMovies(actor, parser, false, false);
        }
        
        // Get filmography for writers
        if (isWriterPass)
        {
          parser = wriParser;
          parser.resetPosition();

          if ((parser.skipToEndOf(vdbParserStr[41])) && // name="Writer">Writer</a>
            (parser.skipToEndOf(vdbParserStr[42])))     // </div>
          {
            GetActorMovies(actor, parser, false, true);
          }
        }

        // Get filmography Director
        if (isDirectorPass)
        {
          parser = dirParser;
          parser.resetPosition();
          
          if (parser.skipToEndOf(vdbParserStr[43]) && // name="Director">Director</a>
              parser.skipToEndOf(vdbParserStr[44]))   // </div>
          {
            GetActorMovies(actor, parser, true, false);
          }
        }

        #endregion

        // Add filmography
        if (actor.Count > 0)
        {
          actor.SortActorMoviesByYear();
        }

        return true;
      }
      catch (Exception ex)
      {
        Log.Error("IMDB.GetActorDetails({0} exception:{1} {2} {3}", url.URL, ex.Message, ex.Source, ex.StackTrace);
      }
      return false;
    }
Ejemplo n.º 5
0
    private void FindIMDBActor(string strURL)
    {
      string[] vdbParserStr = VdbParserStringActor();

      if (vdbParserStr == null || vdbParserStr.Length != 29)
      {
        return;
      }

      try
      {
        string absoluteUri;
        // UTF-8 have problem with special country chars, default IMDB enc is used
        string strBody = GetPage(strURL, "utf-8", out absoluteUri);
        string value = string.Empty;
        HTMLParser parser = new HTMLParser(strBody);
        
        if ((parser.skipToEndOf(vdbParserStr[0])) &&          // <title>
            (parser.extractTo(vdbParserStr[1], ref value)) && // </title>
            !value.ToLower().Equals(vdbParserStr[2]))         // imdb name search
        {
          value = new HTMLUtil().ConvertHTMLToAnsi(value);
          value = Util.Utils.RemoveParenthesis(value).Trim();
          IMDBUrl oneUrl = new IMDBUrl(absoluteUri, value, "IMDB");
          _elements.Add(oneUrl);
          return;
        }

        parser.resetPosition();

        string popularBody = string.Empty;
        string exactBody = string.Empty;
        string url = string.Empty;
        string name = string.Empty;
        string role = string.Empty;

        if (parser.skipToStartOfNoCase(vdbParserStr[3]))      // Popular names
        {
          parser.skipToEndOf(vdbParserStr[4]);                // <table>
          parser.extractTo(vdbParserStr[5], ref popularBody); // </table>

          parser = new HTMLParser(popularBody);
          
          while (parser.skipToStartOf(vdbParserStr[6]))       // href="/name/
          {
            parser.skipToEndOf(vdbParserStr[7]);              // href="
            parser.extractTo(vdbParserStr[8], ref url);       // "
            parser.skipToEndOf(vdbParserStr[9]);              // Image()).src='/rg/find-name-
            parser.skipToEndOf(vdbParserStr[10]);             // ';">
            parser.extractTo(vdbParserStr[11], ref name);     // </a>
            parser.skipToEndOf(vdbParserStr[12]);             // <small>(
            parser.extractTo(vdbParserStr[13], ref role);     // ,
            
            if (role != string.Empty)
            {
              name += " - " + role;
            }

            name = new HTMLUtil().ConvertHTMLToAnsi(name);
            name = Util.Utils.RemoveParenthesis(name).Trim();
            IMDBUrl newUrl = new IMDBUrl("http://www.imdb.com" + url, name, "IMDB");
            _elements.Add(newUrl);
            parser.skipToEndOf(vdbParserStr[14]); // </tr>
          }
        }
        parser = new HTMLParser(strBody);
        
        if (parser.skipToStartOfNoCase(vdbParserStr[15]))       // Exact Matches
        {
          parser.skipToEndOf(vdbParserStr[16]);                 // <table>
          parser.extractTo(vdbParserStr[17], ref exactBody);    // </table>
        }
        else if (parser.skipToStartOfNoCase(vdbParserStr[18]))  // Approx Matches
        {
          parser.skipToEndOf(vdbParserStr[19]);                 // <table>
          parser.extractTo(vdbParserStr[20], ref exactBody);    // </table>
        }
        else
        {
          return;
        }

        parser = new HTMLParser(exactBody);
        url = string.Empty;
        name = string.Empty;
        role = string.Empty;
        
        while (parser.skipToStartOf(vdbParserStr[21]))  // href="/name/
        {
          parser.skipToEndOf(vdbParserStr[22]);         // href="
          parser.extractTo(vdbParserStr[23], ref url);  // "
          parser.skipToEndOf(vdbParserStr[24]);         // Image()).src='/rg/find-name-
          parser.skipToEndOf(vdbParserStr[25]);         // ';">
          parser.extractTo(vdbParserStr[26], ref name); // </a>
          parser.skipToEndOf(vdbParserStr[27]);         // <small>(
          parser.extractTo(vdbParserStr[28], ref role); // ,

          if (role != string.Empty)
          {
            name += " - " + role;
          }

          name = new HTMLUtil().ConvertHTMLToAnsi(name);
          name = Util.Utils.RemoveParenthesis(name).Trim();
          IMDBUrl newUrl = new IMDBUrl("http://www.imdb.com" + url, name, "IMDB");
          _elements.Add(newUrl);
          parser.skipToEndOf(vdbParserStr[29]); // </tr>
        }
      }
      catch (Exception ex)
      {
        Log.Error("exception for imdb lookup of {0} err:{1} stack:{2}", strURL, ex.Message, ex.StackTrace);
      }
    }
Ejemplo n.º 6
0
    // Changed - parsing all actor DB fields through HTML (IMDB changed HTML code)
    public bool GetActorDetails(IMDBUrl url, bool director, out IMDBActor actor)
    {
      actor = new IMDBActor();
      try
      {
        string absoluteUri;
        string strBody = GetPage(url.URL, "utf-8", out absoluteUri);
        if (strBody == null)
        {
          return false;
        }
        if (strBody.Length == 0)
        {
          return false;
        }
        // IMDBActorID
        try
        {
          int pos = url.URL.LastIndexOf("nm");
          string id = url.URL.Substring(pos, 9).Replace("/", string.Empty);
          actor.IMDBActorID = id;
        }
        catch (Exception) {}

        HTMLParser parser = new HTMLParser(strBody);
        string strThumb = string.Empty;
        string value = string.Empty;
        string value2 = string.Empty;
        // Actor name
        if ((parser.skipToEndOf("<title>")) &&
            (parser.extractTo("- IMDb</title>", ref value)))
        {
          value = new HTMLUtil().ConvertHTMLToAnsi(value);
          value = Util.Utils.RemoveParenthesis(value).Trim();
          actor.Name = HttpUtility.HtmlDecode(value.Trim());
        }
        if (actor.Name == string.Empty)
        {
          actor.Name = url.Title;
        }
        // Photo
        string parserTxt = parser.Content;
        string photoBlock = string.Empty;
        if (parser.skipToStartOf("<td id=\"img_primary\"") &&
            (parser.extractTo("</td>", ref photoBlock)))
        {
          parser.Content = photoBlock;
          if ((parser.skipToEndOf("<img src=\"")) &&
              (parser.extractTo("\"", ref strThumb)))
          {
            actor.ThumbnailUrl = strThumb;
          }
          parser.Content = parserTxt;
        }
        // Birth date
        if ((parser.skipToEndOf("Born:")) &&
            (parser.skipToEndOf("birth_monthday=")) &&
            (parser.skipToEndOf(">")) &&
            (parser.extractTo("<", ref value)) &&
            (parser.skipToEndOf("year=")) &&
            (parser.extractTo("\"", ref value2)))
          
        {
          actor.DateOfBirth = value + " " + value2;
        }
        // Death date
        if ((parser.skipToEndOf(">Died:</h4>")) &&
            (parser.skipToEndOf("deaths\">")) &&
            (parser.extractTo("<", ref value)) &&
            (parser.skipToEndOf("death_date=")) &&
            (parser.extractTo("\"", ref value2)))
        {
          if (actor.DateOfBirth == string.Empty)
            actor.DateOfBirth = "?";
          actor.DateOfBirth += " ~ " + value + " " + value2;
        }

        parser.resetPosition();
        // Birth place
        if ((parser.skipToEndOf("birth_place=")) &&
            (parser.skipToEndOf(">")) &&
            (parser.extractTo("<", ref value)))
        {
          actor.PlaceOfBirth = HttpUtility.HtmlDecode(value);
        }
        //Mini Biography
        parser.resetPosition();
        if ((parser.skipToEndOf("<td id=\"overview-top\">")) &&
            (parser.skipToEndOf("<p>")) &&
            (parser.extractTo("See full bio</a>", ref value)))
        {
          value = new HTMLUtil().ConvertHTMLToAnsi(value);
          actor.MiniBiography = Util.Utils.stripHTMLtags(value);
          actor.MiniBiography = actor.MiniBiography.Replace("See full bio »", string.Empty).Trim();
          actor.MiniBiography = HttpUtility.HtmlDecode(actor.MiniBiography); // Remove HTML entities like &#189;
          if (actor.MiniBiography != string.Empty)
          {
            // get complete biography
            string bioURL = absoluteUri;
            if (!bioURL.EndsWith("/"))
            {
              bioURL += "/bio";
            }
            else
              bioURL += "bio";
            string strBioBody = GetPage(bioURL, "utf-8", out absoluteUri);
            if (!string.IsNullOrEmpty(strBioBody))
            {
              HTMLParser parser1 = new HTMLParser(strBioBody);
              if (parser1.skipToEndOf("<h5>Mini Biography</h5>") &&
                  parser1.extractTo("</p>", ref value))
              {
                value = new HTMLUtil().ConvertHTMLToAnsi(value);
                actor.Biography = Util.Utils.stripHTMLtags(value).Trim();
                actor.Biography = HttpUtility.HtmlDecode(actor.Biography); // Remove HTML entities like &#189;
              }
            }
          }
        }
        // Person is movie director or an actor/actress
        bool isActorPass = false;
        bool isDirectorPass = false;
        parser.resetPosition();

        if (director)
        {
          if ((parser.skipToEndOf("name=\"Director\">Director</a>")) &&
              (parser.skipToEndOf("</div>")))
          {
            isDirectorPass = true;
          }
        }
        else
        {
          if (parser.skipToEndOf("name=\"Actress\">Actress</a>") || parser.skipToEndOf("name=\"Actor\">Actor</a>"))
          {
            isActorPass = true;
          }
        }
        // Get filmography
        if (isDirectorPass | isActorPass)
        {
          string movies = string.Empty;
          // Get films and roles block
          if (parser.extractTo("<div id", ref movies))
          {
            parser.Content = movies;
          }
          // Parse block for evey film and get year, title and it's imdbID and role
          while (parser.skipToStartOf("<span class=\"year_column\""))
          {
            string movie = string.Empty;
            if (parser.extractTo("<div class", ref movie))
            {
              movie += "</li>";
              HTMLParser movieParser = new HTMLParser(movie);
              string title = string.Empty;
              string strYear = string.Empty;
              string role = string.Empty;
              string imdbID = string.Empty;
              // IMDBid
              movieParser.skipToEndOf("title/");
              movieParser.extractTo("/", ref imdbID);
              // Title
              movieParser.resetPosition();
              movieParser.skipToEndOf("<a");
              movieParser.skipToEndOf(">");
              movieParser.extractTo("<br/>", ref title);
              title = Util.Utils.stripHTMLtags(title);
              title = title.Replace("\n", " ").Replace("\r", string.Empty);
              title = HttpUtility.HtmlDecode(title.Trim()); // Remove HTML entities like &#189;
              // Year
              movieParser.resetPosition();
              if (movieParser.skipToStartOf(">20") &&
                  movieParser.skipToEndOf(">"))
              {
                movieParser.extractTo("<", ref strYear);
              }
              else if (movieParser.skipToStartOf(">19") &&
                       movieParser.skipToEndOf(">"))
              {
                movieParser.extractTo("<", ref strYear);
              }
              // Roles
              if ((director == false) && (movieParser.skipToEndOf("<br/>"))) // Role case 1, no character link
              {
                movieParser.extractTo("<", ref role);
                role = Util.Utils.stripHTMLtags(role).Trim();
                role = HttpUtility.HtmlDecode(role.Replace("\n", " ")
                                                .Replace("\r", string.Empty).Trim());
                if (role == string.Empty) // Role case 2, with character link
                {
                  movieParser.resetPosition();
                  movieParser.skipToEndOf("<br/>");
                  movieParser.extractTo("</a>", ref role);
                  role = Util.Utils.stripHTMLtags(role).Trim();
                  role = HttpUtility.HtmlDecode(role.Replace("\n", " ")
                                                  .Replace("\r", string.Empty).Trim());
                }
              }
              else
              {
                // Just director
                if (director)
                  role = "Director";
              }

              int year = 0;
              try
              {
                year = Int32.Parse(strYear.Substring(0, 4));
              }
              catch (Exception)
              {
                year = 1900;
              }
              IMDBActor.IMDBActorMovie actorMovie = new IMDBActor.IMDBActorMovie();
              actorMovie.MovieTitle = title;
              actorMovie.Role = role;
              actorMovie.Year = year;
              actorMovie.imdbID = imdbID;
              actor.Add(actorMovie);
            }
          }
        }
        return true;
      }
      catch (Exception ex)
      {
        Log.Error("IMDB.GetActorDetails({0} exception:{1} {2} {3}", url.URL, ex.Message, ex.Source, ex.StackTrace);
      }
      return false;
    }
Ejemplo n.º 7
0
 // Changed - IMDB changed HTML code
 private void FindIMDBActor(string strURL)
 {
   try
   {
     string absoluteUri;
     // UTF-8 have problem with special country chars, default IMDB enc is used
     string strBody = GetPage(strURL, "utf-8", out absoluteUri);
     string value = string.Empty;
     HTMLParser parser = new HTMLParser(strBody);
     if ((parser.skipToEndOf("<title>")) &&
         (parser.extractTo("</title>", ref value)) && !value.ToLower().Equals("imdb name search"))
     {
       value = new HTMLUtil().ConvertHTMLToAnsi(value);
       value = Util.Utils.RemoveParenthesis(value).Trim();
       IMDBUrl oneUrl = new IMDBUrl(absoluteUri, value, "IMDB");
       _elements.Add(oneUrl);
       return;
     }
     parser.resetPosition();
     
     while (parser.skipToEndOfNoCase("Exact Matches"))
     {
       string url = string.Empty;
       string name = string.Empty;
       //<a href="/name/nm0000246/" onclick="set_args('nm0000246', 1)">Bruce Willis</a>
       if (parser.skipToStartOf("href=\"/name/"))
       {
         parser.skipToEndOf("href=\"");
         parser.extractTo("\"", ref url);
         parser.skipToEndOf("<br><a");
         parser.skipToEndOf(">");
         parser.extractTo("</a>", ref name);
         name = new HTMLUtil().ConvertHTMLToAnsi(name);
         name = Util.Utils.RemoveParenthesis(name).Trim();
         IMDBUrl newUrl = new IMDBUrl("http://akas.imdb.com" + url, name, "IMDB");
         _elements.Add(newUrl);
       }
       else
       {
         parser.skipToEndOfNoCase("</a>");
       }
     }
     // Maybe more actors with the similar name
     parser.resetPosition();
     
     while (parser.skipToEndOfNoCase("Popular Names"))
     {
       string url = string.Empty;
       string name = string.Empty;
       //<a href="/name/nm0000246/" onclick="set_args('nm0000246', 1)">Bruce Willis</a>
       if (parser.skipToStartOf("href=\"/name/"))
       {
         parser.skipToEndOf("href=\"");
         parser.extractTo("\"", ref url);
         parser.skipToEndOf("<br><a");
         parser.skipToEndOf(">");
         parser.extractTo("</a>", ref name);
         name = new HTMLUtil().ConvertHTMLToAnsi(name);
         name = Util.Utils.RemoveParenthesis(name).Trim();
         IMDBUrl newUrl = new IMDBUrl("http://akas.imdb.com" + url, name, "IMDB");
         _elements.Add(newUrl);
       }
       else
       {
         parser.skipToEndOfNoCase("</a>");
       }
     }
   }
   catch (Exception ex)
   {
     Log.Error("exception for imdb lookup of {0} err:{1} stack:{2}", strURL, ex.Message, ex.StackTrace);
   }
 }
    public bool FindAlbuminfo(string strAlbum, string artistName, int releaseYear)
    {
      _albumList.Clear();

//     strAlbum="1999";//escapolygy";

      // make request
      // type is 
      // http://www.allmusic.com/cg/amg.dll?P=amg&SQL=escapolygy&OPT1=2

      HTMLUtil util = new HTMLUtil();
      string postData = String.Format("P=amg&SQL={0}&OPT1=2", HttpUtility.UrlEncode(strAlbum));

      string html = PostHTTP("http://www.allmusic.com/cg/amg.dll", postData);
      if (html.Length == 0)
      {
        return false;
      }

      // check if this is an album
      MusicAlbumInfo newAlbum = new MusicAlbumInfo();
      newAlbum.AlbumURL = "http://www.allmusic.com/cg/amg.dll?" + postData;
      if (newAlbum.Parse(html))
      {
        _albumList.Add(newAlbum);
        return true;
      }

      string htmlLow = html;
      htmlLow = htmlLow.ToLower();
      int startOfTable = htmlLow.IndexOf("id=\"expansiontable1\"");
      if (startOfTable < 0)
      {
        return false;
      }
      startOfTable = htmlLow.LastIndexOf("<table", startOfTable);
      if (startOfTable < 0)
      {
        return false;
      }

      HTMLTable table = new HTMLTable();
      string strTable = html.Substring(startOfTable);
      table.Parse(strTable);

      for (int i = 1; i < table.Rows; ++i)
      {
        HTMLTable.HTMLRow row = table.GetRow(i);
        string albumName = "";
        string albumUrl = "";
        string nameOfAlbum = "";
        string nameOfArtist = "";
        for (int iCol = 0; iCol < row.Columns; ++iCol)
        {
          string column = row.GetColumValue(iCol);
          if (iCol == 1 && (column.Length != 0))
          {
            albumName = "(" + column + ")";
          }
          if (iCol == 2)
          {
            nameOfArtist = column;
            util.RemoveTags(ref nameOfArtist);
            if (!column.Equals("&nbsp;"))
            {
              albumName = String.Format("- {0} {1}", nameOfArtist, albumName);
            }
          }
          if (iCol == 4)
          {
            string tempAlbum = column;
            util.RemoveTags(ref tempAlbum);
            albumName = String.Format("{0} {1}", tempAlbum, albumName);
            nameOfAlbum = tempAlbum;
          }
          if (iCol == 4 && column.IndexOf("<a href=\"") >= 0)
          {
            int pos1 = column.IndexOf("<a href=\"");
            pos1 += +"<a href=\"".Length;
            int iPos2 = column.IndexOf("\">", pos1);
            if (iPos2 >= 0)
            {
              if (nameOfAlbum.Length == 0)
              {
                nameOfAlbum = albumName;
              }

              // full album url:
              // http://www.allmusic.com/cg/amg.dll?p=amg&token=&sql=10:66jieal64xs7
              string url = column.Substring(pos1, iPos2 - pos1);
              string albumNameStripped;
              albumUrl = String.Format("http://www.allmusic.com{0}", url);
              MusicAlbumInfo newAlbumInfo = new MusicAlbumInfo();
              util.ConvertHTMLToAnsi(albumName, out albumNameStripped);
              newAlbumInfo.Title2 = albumNameStripped;
              newAlbumInfo.AlbumURL = util.ConvertHTMLToAnsi(albumUrl);
              newAlbumInfo.Artist = util.ConvertHTMLToAnsi(nameOfArtist);
              newAlbumInfo.Title = util.ConvertHTMLToAnsi(nameOfAlbum);
              _albumList.Add(newAlbumInfo);
            }
          }
        }
      }

      // now sort
      _albumList.Sort(new AlbumSort(strAlbum, artistName, releaseYear));
      return true;
    }
Ejemplo n.º 9
0
    /// <summary>
    /// Parse the Detail Page returned from the Allmusic Scraper
    /// </summary>
    /// <param name="strHTML"></param>
    /// <returns></returns>
    public bool Parse(string strHTML)
    {
      HTMLUtil util = new HTMLUtil();
      int begIndex = 0;
      int endIndex = 0;
      string strHTMLLow = strHTML.ToLower();

      // Get the Artist Name
      string pattern = @"<h1.*class=""title"">(.*)</h1>";
      if (!FindPattern(pattern, strHTML))
      {
        return false;
      }

      _strArtistName = _match.Groups[1].Value;

      // Born
      pattern = @"<h3>.*Born.*</h3>\s*?<p>(.*)</p>";
      if (FindPattern(pattern, strHTML))
      {
        string strValue = _match.Groups[1].Value;
        util.RemoveTags(ref strValue);
        util.ConvertHTMLToAnsi(strValue, out _strBorn);
        _strBorn = _strBorn.Trim();
      }

      // Years Active
      pattern = @"(<span.*?class=""active"">(.*?)</span>)";
      if (FindPattern(pattern, strHTML))
      {
        while (_match.Success)
        {
          _strYearsActive += string.Format("{0}s, ", _match.Groups[2].Value);
          _match = _match.NextMatch();
        }
        _strYearsActive = _strYearsActive.Trim(new[] {' ', ','});
      }

      // Genre
      pattern = @"<div.*?id=""genre-style"">\s*?.*?\s*?<h3>.*?Genres.*?</h3>\s*?.*?(<p>(.*?)</p>)";
      if (FindPattern(pattern, strHTML))
      {
        string data = "";
        while (_match.Success)
        {
          data += string.Format("{0}, ", _match.Groups[2].Value);
          _match = _match.NextMatch();
        }
        util.RemoveTags(ref data);
        util.ConvertHTMLToAnsi(data, out _strGenres);
        _strGenres = _strGenres.Trim(new[] {' ', ','});
      }

      // Style
      begIndex = strHTMLLow.IndexOf("<h3>styles</h3>");
      endIndex = strHTMLLow.IndexOf("<!--end genre/styles-->", begIndex + 2);

      if (begIndex != -1 && endIndex != -1)
      {
        string contentInfo = strHTML.Substring(begIndex, endIndex - begIndex);
        pattern = @"(<li>(.*?)</li>)";
        if (FindPattern(pattern, contentInfo))
        {
          string data = "";
          while (_match.Success)
          {
            data += string.Format("{0}, ", _match.Groups[2].Value);
            _match = _match.NextMatch();
          }
          util.RemoveTags(ref data);
          util.ConvertHTMLToAnsi(data, out _strStyles);
          _strStyles = _strStyles.Trim(new[] {' ', ','});
        }
      }

      // Mood
      begIndex = strHTMLLow.IndexOf("<h3>moods</h3>");
      endIndex = strHTMLLow.IndexOf("</div>", begIndex + 2);
      if (begIndex != -1 && endIndex != -1)
      {
        string contentInfo = strHTML.Substring(begIndex, endIndex - begIndex);
        pattern = @"(<li>(.*?)</li>)";
        if (FindPattern(pattern, contentInfo))
        {
          string data = "";
          while (_match.Success)
          {
            data += string.Format("{0}, ", _match.Groups[2].Value);
            _match = _match.NextMatch();
          }
          util.RemoveTags(ref data);
          util.ConvertHTMLToAnsi(data, out _strTones);
          _strTones = _strTones.Trim(new[] {' ', ','});
        }
      }

      // Instruments
      begIndex = strHTMLLow.IndexOf("<h3>instruments</h3>");
      endIndex = strHTMLLow.IndexOf("</div>", begIndex + 2);
      if (begIndex != -1 && endIndex != -1)
      {
        string contentInfo = strHTML.Substring(begIndex, endIndex - begIndex);
        if (FindPattern(pattern, contentInfo))
        {
          string data = "";
          while (_match.Success)
          {
            data += string.Format("{0}, ", _match.Groups[2].Value);
            _match = _match.NextMatch();
          }
          util.RemoveTags(ref data);
          util.ConvertHTMLToAnsi(data, out _strInstruments);
          _strInstruments = _strInstruments.Trim(new[] {' ', ','});
        }
      }

      // picture URL
      pattern = @"<div.*?class=""image"">\s*?.*<img.*id=""artist_image"".*?src=\""(.*?)\""";
      if (FindPattern(pattern, strHTML))
      {
        _strArtistPictureURL = _match.Groups[1].Value;
      }

      // parse AMG BIOGRAPHY
      pattern = @"<td.*?class=""tab_off""><a.*?href=""(.*?)"">.*?Biography.*?</a>";
      if (FindPattern(pattern, strHTML))
      {
        try
        {
          string contentinfo = AllmusicSiteScraper.GetHTTP(_match.Groups[1].Value);
          begIndex = contentinfo.IndexOf("<!--Begin Biography -->");
          endIndex = contentinfo.IndexOf("</div>", begIndex + 2);
          if (begIndex != -1 && endIndex != -1)
          {
            pattern = @"<p.*?class=""text"">(.*?)</p>";
            if (FindPattern(pattern, contentinfo))
            {
              string data = _match.Groups[1].Value;
              util.RemoveTags(ref data);
              util.ConvertHTMLToAnsi(data, out data);
              _strAMGBiography = data.Trim();
            }
          }
        }
        catch (Exception) {}
      }


      string compilationPage = "";
      string singlesPage = "";
      string dvdPage = "";
      string miscPage = "";

      // discography (albums)
      pattern = @"<td.*class=""tab_off""><a.*?href=""(.*?)"">.*Discography.*</a>";
      if (FindPattern(pattern, strHTML))
      {
        // Get Link to other sub pages
        compilationPage = _match.Groups[1].Value + "/compilations";
        singlesPage = _match.Groups[1].Value + "/singles-eps";
        dvdPage = _match.Groups[1].Value + "/dvds-videos";
        miscPage = _match.Groups[1].Value + "/other";

        try
        {
          string contentinfo = AllmusicSiteScraper.GetHTTP(_match.Groups[1].Value);
          pattern = @"sorted.*? cell"">(?<year>.*?)</td>\s*?.*?</td>\s*.*?<a.*?"">(?<album>.*?)" +
                    @"</a>.*?</td>\s*.*?</td>\s*.*?"">(?<label>.*?)</td>";

          if (FindPattern(pattern, contentinfo))
          {
            while (_match.Success)
            {
              string year = _match.Groups["year"].Value;
              string albumTitle = _match.Groups["album"].Value;
              string label = _match.Groups["label"].Value;

              util.RemoveTags(ref year);
              util.ConvertHTMLToAnsi(year, out year);
              util.RemoveTags(ref albumTitle);
              util.ConvertHTMLToAnsi(albumTitle, out albumTitle);
              util.RemoveTags(ref label);
              util.ConvertHTMLToAnsi(label, out label);

              try
              {
                string[] dAlbumInfo = {year.Trim(), albumTitle.Trim(), label.Trim()};
                _discographyAlbum.Add(dAlbumInfo);
              }
              catch {}

              _match = _match.NextMatch();
            }
          }
        }
        catch (Exception) {}
      }

      // Compilations
      if (compilationPage != "")
      {
        try
        {
          string contentinfo = AllmusicSiteScraper.GetHTTP(compilationPage);
          pattern = @"sorted.*? cell"">(?<year>.*?)</td>\s*?.*?</td>\s*.*?<a.*?"">(?<album>.*?)" +
                    @"</a>.*?</td>\s*.*?</td>\s*.*?"">(?<label>.*?)</td>";

          if (FindPattern(pattern, contentinfo))
          {
            while (_match.Success)
            {
              string year = _match.Groups["year"].Value;
              string albumTitle = _match.Groups["album"].Value;
              string label = _match.Groups["label"].Value;

              util.RemoveTags(ref year);
              util.ConvertHTMLToAnsi(year, out year);
              util.RemoveTags(ref albumTitle);
              util.ConvertHTMLToAnsi(albumTitle, out albumTitle);
              util.RemoveTags(ref label);
              util.ConvertHTMLToAnsi(label, out label);

              try
              {
                string[] dAlbumInfo = {year.Trim(), albumTitle.Trim(), label.Trim()};
                _discographyCompilations.Add(dAlbumInfo);
              }
              catch {}

              _match = _match.NextMatch();
            }
          }
        }
        catch (Exception) {}
      }

      // Singles
      if (singlesPage != "")
      {
        try
        {
          string contentinfo = AllmusicSiteScraper.GetHTTP(singlesPage);
          pattern = @"sorted.*? cell"">(?<year>.*?)</td>\s*?.*?</td>\s*.*?<a.*?"">(?<album>.*?)" +
                    @"</a>.*?</td>\s*.*?</td>\s*.*?"">(?<label>.*?)</td>";

          if (FindPattern(pattern, contentinfo))
          {
            while (_match.Success)
            {
              string year = _match.Groups["year"].Value;
              string albumTitle = _match.Groups["album"].Value;
              string label = _match.Groups["label"].Value;

              util.RemoveTags(ref year);
              util.ConvertHTMLToAnsi(year, out year);
              util.RemoveTags(ref albumTitle);
              util.ConvertHTMLToAnsi(albumTitle, out albumTitle);
              util.RemoveTags(ref label);
              util.ConvertHTMLToAnsi(label, out label);

              try
              {
                string[] dAlbumInfo = {year.Trim(), albumTitle.Trim(), label.Trim()};
                _discographySingles.Add(dAlbumInfo);
              }
              catch {}

              _match = _match.NextMatch();
            }
          }
        }
        catch (Exception) {}
      }

      // DVD Videos
      if (dvdPage != "")
      {
        try
        {
          string contentinfo = AllmusicSiteScraper.GetHTTP(dvdPage);
          pattern = @"sorted.*? cell"">(?<year>.*?)</td>\s*?.*?</td>\s*.*?<a.*?"">(?<album>.*?)" +
                    @"</a>.*?</td>\s*.*?</td>\s*.*?"">(?<label>.*?)</td>";

          if (FindPattern(pattern, contentinfo))
          {
            while (_match.Success)
            {
              string year = _match.Groups["year"].Value;
              string albumTitle = _match.Groups["album"].Value;
              string label = _match.Groups["label"].Value;

              util.RemoveTags(ref year);
              util.ConvertHTMLToAnsi(year, out year);
              util.RemoveTags(ref albumTitle);
              util.ConvertHTMLToAnsi(albumTitle, out albumTitle);
              util.RemoveTags(ref label);
              util.ConvertHTMLToAnsi(label, out label);

              try
              {
                string[] dAlbumInfo = {year.Trim(), albumTitle.Trim(), label.Trim()};
                _discographyMisc.Add(dAlbumInfo);
              }
              catch {}

              _match = _match.NextMatch();
            }
          }
        }
        catch (Exception) {}
      }

      // Other
      if (miscPage != "")
      {
        try
        {
          string contentinfo = AllmusicSiteScraper.GetHTTP(miscPage);
          pattern = @"sorted.*? cell"">(?<year>.*?)</td>\s*?.*?</td>\s*.*?<a.*?"">(?<album>.*?)" +
                    @"</a>.*?</td>\s*.*?</td>\s*.*?"">(?<label>.*?)</td>";

          if (FindPattern(pattern, contentinfo))
          {
            while (_match.Success)
            {
              string year = _match.Groups["year"].Value;
              string albumTitle = _match.Groups["album"].Value;
              string label = _match.Groups["label"].Value;

              util.RemoveTags(ref year);
              util.ConvertHTMLToAnsi(year, out year);
              util.RemoveTags(ref albumTitle);
              util.ConvertHTMLToAnsi(albumTitle, out albumTitle);
              util.RemoveTags(ref label);
              util.ConvertHTMLToAnsi(label, out label);

              try
              {
                string[] dAlbumInfo = {year.Trim(), albumTitle.Trim(), label.Trim()};
                _discographyMisc.Add(dAlbumInfo);
              }
              catch {}

              _match = _match.NextMatch();
            }
          }
        }
        catch (Exception) {}
      }

      _bLoaded = true;
      return _bLoaded;
    }
Ejemplo n.º 10
0
    public bool Parse(string html)
    {
      _songs.Clear();
      HTMLUtil util = new HTMLUtil();
      string strHtmlLow = html.ToLower();

      int begIndex = 0;
      int endIndex = 0;

      //	Extract Cover URL
      string pattern = @"<!--Begin.*?Album.*?Photo-->\s*?.*?<img.*?src=\""(.*?)\""";
      if (FindPattern(pattern, html))
      {
        _strImageURL = _match.Groups[1].Value;
      }

      //	Extract Review
      pattern = @"<td.*?class=""tab_off""><a.*?href=""(.*?)"">.*?Review.*?</a>";
      if (FindPattern(pattern, html))
      {
        try
        {
          string contentinfo = AllmusicSiteScraper.GetHTTP(_match.Groups[1].Value);
          pattern = @"<p.*?class=""author"">.*\s*?.*?<p.*?class=""text"">(.*?)</p>";
          if (FindPattern(pattern, contentinfo))
          {
            string data = _match.Groups[1].Value;
            util.RemoveTags(ref data);
            util.ConvertHTMLToAnsi(data, out data);
            _strReview = data.Trim();
          }
        }
        catch (Exception) {}
      }

      //	Extract Artist
      pattern = @"<h3.*?artist</h3>\s*?.*?<a.*"">(.*)</a>";
      if (FindPattern(pattern, html))
      {
        _artist = _match.Groups[1].Value;
        util.RemoveTags(ref _artist);
      }

      //	Extract Album
      pattern = @"<h3.*?album</h3>\s*?.*?<p>(.*)</P>";
      if (FindPattern(pattern, html))
      {
        _strTitle = _match.Groups[1].Value;
        util.RemoveTags(ref _strTitle);
      }

      // Extract Rating
      pattern = @"<h3.*?rating</h3>\s*?.*?src=""(.*?)""";
      if (FindPattern(pattern, html))
      {
        string strRating = _match.Groups[1].Value;
        util.RemoveTags(ref strRating);
        strRating = strRating.Substring(26, 1);
        try
        {
          _iRating = Int32.Parse(strRating);
        }
        catch (Exception) {}
      }

      //	Release Date
      pattern = @"<h3.*?release.*?date</h3>\s*?.*?<p>(.*)</P>";
      if (FindPattern(pattern, html))
      {
        _strDateOfRelease = _match.Groups[1].Value;
        util.RemoveTags(ref _strDateOfRelease);

        //	extract the year out of something like "1998 (release)" or "12 feb 2003"
        int nPos = _strDateOfRelease.IndexOf("19");
        if (nPos > -1)
        {
          if ((int)_strDateOfRelease.Length >= nPos + 3 && Char.IsDigit(_strDateOfRelease[nPos + 2]) &&
              Char.IsDigit(_strDateOfRelease[nPos + 3]))
          {
            string strYear = _strDateOfRelease.Substring(nPos, 4);
            _strDateOfRelease = strYear;
          }
          else
          {
            nPos = _strDateOfRelease.IndexOf("19", nPos + 2);
            if (nPos > -1)
            {
              if ((int)_strDateOfRelease.Length >= nPos + 3 && Char.IsDigit(_strDateOfRelease[nPos + 2]) &&
                  Char.IsDigit(_strDateOfRelease[nPos + 3]))
              {
                string strYear = _strDateOfRelease.Substring(nPos, 4);
                _strDateOfRelease = strYear;
              }
            }
          }
        }

        nPos = _strDateOfRelease.IndexOf("20");
        if (nPos > -1)
        {
          if ((int)_strDateOfRelease.Length > nPos + 3 && Char.IsDigit(_strDateOfRelease[nPos + 2]) &&
              Char.IsDigit(_strDateOfRelease[nPos + 3]))
          {
            string strYear = _strDateOfRelease.Substring(nPos, 4);
            _strDateOfRelease = strYear;
          }
          else
          {
            nPos = _strDateOfRelease.IndexOf("20", nPos + 1);
            if (nPos > -1)
            {
              if ((int)_strDateOfRelease.Length > nPos + 3 && Char.IsDigit(_strDateOfRelease[nPos + 2]) &&
                  Char.IsDigit(_strDateOfRelease[nPos + 3]))
              {
                string strYear = _strDateOfRelease.Substring(nPos, 4);
                _strDateOfRelease = strYear;
              }
            }
          }
        }
      }

      // Extract Genre
      begIndex = strHtmlLow.IndexOf("<h3>genre</h3>");
      endIndex = strHtmlLow.IndexOf("</div>", begIndex + 2);
      if (begIndex != -1 && endIndex != -1)
      {
        string contentInfo = html.Substring(begIndex, endIndex - begIndex);
        pattern = @"(<li>(.*?)</li>)";
        if (FindPattern(pattern, contentInfo))
        {
          string data = "";
          while (_match.Success)
          {
            data += string.Format("{0}, ", _match.Groups[2].Value);
            _match = _match.NextMatch();
          }
          util.RemoveTags(ref data);
          util.ConvertHTMLToAnsi(data, out _strGenre);
          _strGenre = _strGenre.Trim(new[] {' ', ','});
        }
      }

      // Extract Styles
      begIndex = strHtmlLow.IndexOf("<h3>style</h3>");
      endIndex = strHtmlLow.IndexOf("</div>", begIndex + 2);
      if (begIndex != -1 && endIndex != -1)
      {
        string contentInfo = html.Substring(begIndex, endIndex - begIndex);
        pattern = @"(<li>(.*?)</li>)";
        if (FindPattern(pattern, contentInfo))
        {
          string data = "";
          while (_match.Success)
          {
            data += string.Format("{0}, ", _match.Groups[2].Value);
            _match = _match.NextMatch();
          }
          util.RemoveTags(ref data);
          util.ConvertHTMLToAnsi(data, out _strStyles);
          _strStyles = _strStyles.Trim(new[] {' ', ','});
        }
      }

      // Extract Moods
      begIndex = strHtmlLow.IndexOf("<h3>moods</h3>");
      endIndex = strHtmlLow.IndexOf("</div>", begIndex + 2);
      if (begIndex != -1 && endIndex != -1)
      {
        string contentInfo = html.Substring(begIndex, endIndex - begIndex);
        pattern = @"(<li>(.*?)</li>)";
        if (FindPattern(pattern, contentInfo))
        {
          string data = "";
          while (_match.Success)
          {
            data += string.Format("{0}, ", _match.Groups[2].Value);
            _match = _match.NextMatch();
          }
          util.RemoveTags(ref data);
          util.ConvertHTMLToAnsi(data, out _strTones);
          _strTones = _strTones.Trim(new[] {' ', ','});
        }
      }

      // Extract Songs
      begIndex = strHtmlLow.IndexOf("<!-- tracks table -->");
      endIndex = strHtmlLow.IndexOf("<!-- end tracks table -->", begIndex + 2);
      if (begIndex != -1 && endIndex != -1)
      {
        string contentInfo = html.Substring(begIndex, endIndex - begIndex);
        pattern = @"<tr.*class=""visible"".*?\s*?<td.*</td>\s*?.*<td.*</td>\s*?.*<td.*?>(?<track>.*)</td>" +
                  @"\s*?.*<td.*</td>\s*?.*<td.*?>(?<title>.*)</td>\s*?.*?<td.*?>\s*?.*</td>\s*?.*?<td.*?>(?<duration>.*)</td>";

        if (FindPattern(pattern, contentInfo))
        {
          while (_match.Success)
          {
            //	Tracknumber
            int iTrack = 0;
            try
            {
              iTrack = Int32.Parse(_match.Groups["track"].Value);
            }
            catch (Exception) {}

            // Song Title
            string strTitle = _match.Groups["title"].Value;
            util.RemoveTags(ref strTitle);
            util.ConvertHTMLToAnsi(strTitle, out strTitle);

            //	Duration
            int iDuration = 0;
            string strDuration = _match.Groups["duration"].Value;
            int iPos = strDuration.IndexOf(":");
            if (iPos >= 0)
            {
              string strMin, strSec;
              strMin = strDuration.Substring(0, iPos);
              iPos++;
              strSec = strDuration.Substring(iPos);
              int iMin = 0, iSec = 0;
              try
              {
                iMin = Int32.Parse(strMin);
                iSec = Int32.Parse(strSec);
              }
              catch (Exception) {}
              iDuration = iMin * 60 + iSec;
            }

            //	Create new song object
            MusicSong newSong = new MusicSong();
            newSong.Track = iTrack;
            newSong.SongName = strTitle;
            newSong.Duration = iDuration;
            _songs.Add(newSong);

            _match = _match.NextMatch();
          }
        }
      }

      //	Set to "Not available" if no value from web
      if (_artist.Length == 0)
      {
        _artist = GUILocalizeStrings.Get(416);
      }
      if (_strDateOfRelease.Length == 0)
      {
        _strDateOfRelease = GUILocalizeStrings.Get(416);
      }
      if (_strGenre.Length == 0)
      {
        _strGenre = GUILocalizeStrings.Get(416);
      }
      if (_strTones.Length == 0)
      {
        _strTones = GUILocalizeStrings.Get(416);
      }
      if (_strStyles.Length == 0)
      {
        _strStyles = GUILocalizeStrings.Get(416);
      }
      if (_strTitle.Length == 0)
      {
        _strTitle = GUILocalizeStrings.Get(416);
      }

      if (_strTitle2.Length == 0)
      {
        _strTitle2 = _strTitle;
      }

      Loaded = true;
      return true;
    }
    /// <summary>
    /// Search on Allmusic for the requested string
    /// </summary>
    /// <param name="searchBy"></param>
    /// <param name="searchStr"></param>
    /// <returns></returns>
    public bool FindInfo(SearchBy searchBy, string searchStr)
    {
      _searchby = searchBy;
      HTMLUtil util = new HTMLUtil();
      string strPostData = "";
      if (SearchBy.Albums == searchBy)
      {
        strPostData = string.Format(ALBUMSEARCH, HttpUtility.UrlEncode(searchStr));
      }
      else
      {
        searchStr = SwitchArtist(searchStr);
        strPostData = string.Format(ARTISTSEARCH, HttpUtility.UrlEncode(searchStr));
      }

      string strHTML = PostHTTP(MAINURL + URLPROGRAM, strPostData);
      if (strHTML.Length == 0)
      {
        return false;
      }

      _htmlCode = strHTML; // save the html content...

      Regex multiples = new Regex(
        @"\sSearch\sResults\sfor:",
        RegexOptions.IgnoreCase
        | RegexOptions.Multiline
        | RegexOptions.IgnorePatternWhitespace
        | RegexOptions.Compiled
        );

      if (multiples.IsMatch(strHTML))
      {
        string pattern = "";
        if (searchBy.ToString().Equals("Artists"))
        {
          pattern = @"<tr.*?>\s*?.*?<td\s*?class=""relevance\stext-center"">\s*?.*\s*?.*</td>" +
                    @"\s*?.*<td.*\s*?.*</td>\s*?.*<td>.*<a.*href=""(?<code>.*?)"">(?<name>.*)</a>.*</td>" +
                    @"\s*?.*<td>(?<detail>.*)</td>\s*?.*<td>(?<detail2>.*)</td>";
        }
        else if (searchBy.ToString().Equals("Albums"))
        {
          pattern = @"<tr.*?>\s*?.*?<td\s*?class=""relevance\stext-center"">\s*?.*\s*?.*</td>" +
                    @"\s*?.*<td.*\s*?.*</td>\s*?.*<td>.*<a.*href=""(?<code>.*?)"">(?<name>.*)</a>.*</td>" +
                    @"\s*?.*<td>(?<detail>.*)</td>\s*?.*<td>.*</td>\s*?.*<td>(?<detail2>.*)</td>";
        }


        Match m;
        Regex itemsFoundFromSite = new Regex(
          pattern,
          RegexOptions.IgnoreCase
          | RegexOptions.Multiline
          | RegexOptions.IgnorePatternWhitespace
          | RegexOptions.Compiled
          );


        for (m = itemsFoundFromSite.Match(strHTML); m.Success; m = m.NextMatch())
        {
          string code = m.Groups["code"].ToString();
          string name = m.Groups["name"].ToString();
          string detail = m.Groups["detail"].ToString();
          string detail2 = m.Groups["detail2"].ToString();

          util.RemoveTags(ref name);
          util.ConvertHTMLToAnsi(name, out name);

          util.RemoveTags(ref detail);
          util.ConvertHTMLToAnsi(detail, out detail);

          util.RemoveTags(ref detail2);
          util.ConvertHTMLToAnsi(detail2, out detail2);

          if (SearchBy.Artists == searchBy)
          {
            detail += " - " + detail2;
            if (detail.Length > 0)
            {
              _codes.Add(code);
              _values.Add(name + " - " + detail);
            }
            else
            {
              _codes.Add(code);
              _values.Add(name);
            }
          }
          else
          {
            MusicAlbumInfo albumInfo = new MusicAlbumInfo();
            albumInfo.AlbumURL = code;
            albumInfo.Artist = detail;
            albumInfo.Title = name;
            albumInfo.DateOfRelease = detail2;
            _albumList.Add(albumInfo);
          }
        }
        _multiple = true;
      }
      else // found the right one
      {}
      return true;
    }
Ejemplo n.º 12
0
        public static string FindWithAction(string body, string keyStart, string keyEnd, string param1, string param2, string param3, string maxItems, string languages, out string allNames, out string allRoles, bool grabActorRoles)
        {
            allNames = string.Empty;
              allRoles = string.Empty;
              int iStart = 0;
              int iEnd = 0;
              int iLength = 0;
              int maxItemsToAdd = 999; // Max number of items to add to matchgroup
              if (!string.IsNullOrEmpty(maxItems)) maxItemsToAdd = Convert.ToInt32(maxItems);
              string strTemp = String.Empty;
              var htmlUtil = new HTMLUtil();
              bool bregexs = false;
              bool bregexe = false;
              if (keyStart.StartsWith("#REGEX#"))
            bregexs = true;
              if (keyEnd.StartsWith("#REGEX#"))
            bregexe = true;

              if (keyStart != "" && keyEnd != "")
              {
            iLength = keyStart.Length;
            if (param1.StartsWith("#REVERSE#"))
            {
              iStart = bregexs ? FindRegEx(body, keyStart, iStart, ref iLength, false) : body.LastIndexOf(keyStart);
            }
            else
              if (bregexs)
            iStart = FindRegEx(body, keyStart, iStart, ref iLength, true);
              else
            iStart = body.IndexOf(keyStart);

            if (iStart > 0)
            {
              if (param1.StartsWith("#REVERSE#"))
              {
            iLength = keyEnd.Length;
            if (bregexe)
              iEnd = FindRegEx(body, keyEnd, iStart, ref iLength, false) + iStart;
            else
              iEnd = body.LastIndexOf(keyEnd, iStart);
              }
              else
              {
            iStart += iLength;
            if (bregexe)
              iEnd = FindRegEx(body, keyEnd, iStart, ref iLength, true) + iStart;
            else
              iEnd = body.IndexOf(keyEnd, iStart);
              }
              if (iEnd > 0)
              {
            if (param1.StartsWith("#REVERSE#"))
            {
              param1 = param1.Substring(9);
              iEnd += iLength;
              strTemp = body.Substring(iEnd, iStart - iEnd);
            }
            else
              strTemp = body.Substring(iStart, iEnd - iStart);
            if (strTemp != "")
            {
              //if (param3.Length > 0)
              //{
              //  Regex oRegex = new Regex(param3);
              //  Regex oRegexReplace = new Regex(string.Empty);
              //  System.Text.RegularExpressions.MatchCollection oMatches = oRegex.Matches(strTemp);
              //  foreach (System.Text.RegularExpressions.Match oMatch in oMatches)
              //  {
              //    if (param1.StartsWith("#REGEX#"))
              //    {
              //      oRegexReplace = new Regex(param1.Substring(7));
              //      strTemp = strTemp.Replace(oMatch.Value, oRegexReplace.Replace(oMatch.Value, param2));
              //    }
              //    else
              //      strTemp = strTemp.Replace(param1, param2);
              //  }
              //}
              //else
              //{
              //  if (param1.StartsWith("#REGEX#"))
              //    strTemp = Regex.Replace(strTemp, param1.Substring(7), param2);
              //  else
              //    if (param1.Length > 0)
              //      strTemp = strTemp.Replace(param1, param2);
              //}
              if (param3.Length > 0)
              {
                RegexOptions regexoption = new RegexOptions();
                regexoption = RegexOptions.Singleline;
                if (param3.StartsWith("#MULTILINE#"))
                {
                  regexoption = RegexOptions.Multiline;
                  param3 = param3.Substring(11);
                }

                //Regex oRegex = new Regex(param3, RegexOptions.Singleline);
                Regex oRegex = new Regex(param3, regexoption);
                Regex oRegexReplace = new Regex(string.Empty);
                strTemp = HttpUtility.HtmlDecode(strTemp);
                if (regexoption != RegexOptions.Multiline)
                  strTemp = HttpUtility.HtmlDecode(strTemp).Replace("\n", "");
                // System.Windows.Forms.Clipboard.SetDataObject(strTemp, false); // Must not be set when called by AMCupdater -> STAThread exception !
                MatchCollection oMatches = oRegex.Matches(strTemp);

                string strPerson = string.Empty;
                string strRole = string.Empty;

                if (oMatches.Count > 0)
                {
                  string strCastDetails = "";
                  int i = 0;
                  foreach (System.Text.RegularExpressions.Match oMatch in oMatches)
                  {
                    strPerson = oMatch.Groups["person"].Value;
                    strPerson = Utils.stripHTMLtags(strPerson).Trim().Replace("\n", "");
                    //strPerson = HttpUtility.HtmlDecode(strPerson).Replace(",", ";");

                    strRole = oMatch.Groups["role"].Value;
                    strRole = Utils.stripHTMLtags(strRole).Trim().Replace("\n", "");
                    //strRole = HttpUtility.HtmlDecode(strRole).Replace(",", ";");

                    if (param1.Length > 0)
                    {
                      if (!string.IsNullOrEmpty(strPerson))
                        strPerson = ReplaceNormalOrRegex(strPerson, param1, "");
                      if (!string.IsNullOrEmpty(strRole))
                        strRole = ReplaceNormalOrRegex(strRole, param1, "");

                      //if (param1.StartsWith("#REGEX#"))
                      //{
                      //  oRegexReplace = new Regex(param1.Substring(7));
                      //  if (!string.IsNullOrEmpty(strPerson))
                      //    strPerson = strPerson.Replace(strPerson, oRegexReplace.Replace(strPerson, param2)).Trim();
                      //  if (!string.IsNullOrEmpty(strRole))
                      //    strRole = strRole.Replace(strRole, oRegexReplace.Replace(strRole, param2)).Trim();
                      //}
                      //else
                      //{
                      //  if (!string.IsNullOrEmpty(strActor))
                      //    strActor = strActor.Replace(param1, param2).Trim();
                      //  if (!string.IsNullOrEmpty(strRole))
                      //    strRole = strRole.Replace(param1, param2).Trim();
                      //}
                    }

                    // build allNames & allRoles strings for dropdowns
                    if (!string.IsNullOrEmpty(allNames)) allNames += ", ";
                    allNames += strPerson;
                    if (!string.IsNullOrEmpty(allRoles)) allRoles += ", ";
                    allRoles += strRole;

                    if (i < maxItemsToAdd) // Limit number of items to add
                    {
                      string[] langSplit = languages.Split(new Char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); // language filter (grabber script or override)

                      if (string.IsNullOrEmpty(languages))
                      {
                        if (!string.IsNullOrEmpty(strCastDetails)) strCastDetails += ", ";
                        strCastDetails += strPerson;
                        if (strRole != string.Empty && grabActorRoles)
                          strCastDetails += " (" + strRole + ")";
                        //strCastDetails += "\n";
                        i = i + 1;
                      }
                      else
                      {
                        foreach (var s in langSplit)
                        {
                          if (strPerson.ToLower().Contains(s.Trim().ToLower()) || strRole.ToLower().Contains(s.Trim().ToLower()))
                          {
                            if (!string.IsNullOrEmpty(strCastDetails)) strCastDetails += ", ";
                            strCastDetails += strPerson;
                            if (strRole != string.Empty && grabActorRoles)
                              strCastDetails += " (" + strRole + ")";
                            // Don't add groupnames when adding TTitles
                            //strCastDetails += "\n";
                            i = i + 1;
                          }
                        }
                        strCastDetails = ReplaceNormalOrRegex(strCastDetails, param1, "");
                        //if (param1.StartsWith("#REGEX#"))
                        //  strCastDetails = Regex.Replace(strCastDetails, param1.Substring(7), param2);
                        //else if (param1.Length > 0)
                        //  strCastDetails = strCastDetails.Replace(param1, param2);
                      }
                    }
                  }
                  strTemp = strCastDetails;
                  if (param2.StartsWith("#")) strTemp = ReplaceNormalOrRegex(strTemp, param2, ""); // Cleanup only - no replacement of inner regex values
                }
                else // no matchcollection found
                {
                  // strTemp = param2.StartsWith("#") ? ReplaceNormalOrRegex(strTemp, param2, "") : ReplaceNormalOrRegex(strTemp, param1, param2);
                  strTemp = ""; // set output to empty string, as no matches were found
                }

                string[] split = allNames.Split(new Char[] { ',', ';', '/' }, StringSplitOptions.RemoveEmptyEntries);
                string strT = string.Empty;
                string strTname = string.Empty;
                string strTrole = string.Empty;
                foreach (var str in split)
                {
                  strT = str.Trim();
                  if (!string.IsNullOrEmpty(strTname)) strTname += ", ";
                  strTname += strT;
                }
                allNames = strTname;

                split = allRoles.Split(new Char[] { ',', ';', '/' }, StringSplitOptions.RemoveEmptyEntries);
                strT = string.Empty;
                strTname = string.Empty;
                strTrole = string.Empty;
                foreach (var str in split)
                {
                  strT = str.Trim();
                  if (!string.IsNullOrEmpty(strTrole)) strTrole += ", ";
                  strTrole += strT;
                }
                allRoles = strTrole;
              }
              else
              {
                strTemp = ReplaceNormalOrRegex(strTemp, param1, param2);
                //System.Windows.Forms.Clipboard.SetDataObject(strTemp, false); // Must NOT be called, when using from AMCupdater, cause it's giving STAThread error !!!
              }

              // Added to enable the addition of surrounding chars for results...
              if (param1.StartsWith("#ADD#") && param2.Length > 0)
              {
                string strExtend = param2;
                string[] strExtendSplit = strExtend.Split(new Char[] { '|' }, StringSplitOptions.None); // { ',', ';', '|' }
                if (strExtendSplit.Length == 2)
                {
                  strTemp = strExtendSplit[0] + strTemp.Trim() + strExtendSplit[1];
                }
                else
                {
                  strTemp = strExtend + strTemp.Trim() + strExtend;
                }
              }

              strTemp = strTemp.Replace("„", "'").Replace("“", "'");
              htmlUtil.RemoveTags(ref strTemp);
              htmlUtil.ConvertHTMLToAnsi(strTemp, out strTemp);
              // strTemp = System.Security.SecurityElement.Escape(strTemp); // escape invalid chars for valid XML value generation
              // strTemp = strTemp.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;").Replace("'", "&apos;");
              // strTemp = strTemp.Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;").Replace("'", "&apos;");
            }
              }
            }

              }
              return strTemp.Trim();
        }
Ejemplo n.º 13
0
        public static string Find(string body, string keyStart, ref int iStart, string keyEnd)
        {
            int iEnd = 0;
              int iLength = 0;

              string strTemp = String.Empty;
              var htmlUtil = new HTMLUtil();
              bool bregexs = false;
              bool bregexe = false;
              if (keyStart.StartsWith("#REGEX#"))
            bregexs = true;
              if (keyEnd.StartsWith("#REGEX#"))
            bregexe = true;
              if (keyStart != "" && keyEnd != "")
              {
            iLength = keyStart.Length;
            if (bregexs)
              iStart = FindRegEx(body, keyStart, iStart, ref iLength, true) + iStart;
            else
              iStart = body.IndexOf(keyStart, iStart);

            if (iStart >= 0)
            {
              iStart += iLength;
              iLength = keyEnd.Length;
              if (bregexe)
            iEnd = FindRegEx(body, keyEnd, iStart, ref iLength, true) + iStart;
              else
            iEnd = body.IndexOf(keyEnd, iStart);
              if (iEnd > 0)
              {
            strTemp = body.Substring(iStart, iEnd - iStart);
            if (strTemp != "")
            {
              htmlUtil.RemoveTags(ref strTemp);
              htmlUtil.ConvertHTMLToAnsi(strTemp, out strTemp);
            }
              }
            }

              }
              return strTemp.Trim();
        }
Ejemplo n.º 14
0
        public static string FindWithAction(string body, string keyStart, ref int iStart, string keyEnd, string param1, string param2, string param3)
        {
            int iEnd = 0;
              int iLength = 0;

              var strTemp = String.Empty;
              var htmlUtil = new HTMLUtil();
              bool bregexs = false;
              bool bregexe = false;
              if (keyStart.StartsWith("#REGEX#"))
            bregexs = true;
              if (keyEnd.StartsWith("#REGEX#"))
            bregexe = true;

              if (keyStart != "" && keyEnd != "")
              {
            iLength = keyStart.Length;
            if (bregexs)
              iStart = FindRegEx(body, keyStart, iStart, ref iLength, true) + iStart;
            else
              iStart = body.IndexOf(keyStart, iStart);
            if (iStart > 0)
            {
              iStart += iLength;
              if (bregexe)
            iEnd = FindRegEx(body, keyEnd, iStart, ref iLength, true) + iStart;
              else
            iEnd = body.IndexOf(keyEnd, iStart);
              if (iEnd > 0)
              {
            strTemp = body.Substring(iStart, iEnd - iStart);
            if (strTemp != "")
            {
              if (param3.Length > 0)
              {
                var oRegex = new Regex(param3);
                var oRegexReplace = new Regex(string.Empty);
                MatchCollection oMatches = oRegex.Matches(strTemp);
                foreach (Match oMatch in oMatches)
                {
                  if (param1.StartsWith("#REGEX#"))
                  {
                    oRegexReplace = new Regex(param1.Substring(7));
                    strTemp = strTemp.Replace(oMatch.Value, oRegexReplace.Replace(oMatch.Value, param2));
                  }
                  else
                    strTemp = strTemp.Replace(param1, param2);
                }
              }
              else
              {
                strTemp = ReplaceNormalOrRegex(strTemp, param1, param2);
              }

              // Added to enable the addition of surrounding chars for results...
              if (param1.StartsWith("#ADD#") && param2.Length > 0)
              {
                string strExtend = param2;
                string[] strExtendSplit = strExtend.Split(new Char[] { '|' }, StringSplitOptions.None);
                if (strExtendSplit.Length == 2)
                {
                  strTemp = strExtendSplit[0] + strTemp.Trim() + strExtendSplit[1];
                }
                else
                {
                  strTemp = strExtend + strTemp.Trim() + strExtend;
                }
              }

              strTemp = strTemp.Replace("„", "'").Replace("“", "'");
              htmlUtil.RemoveTags(ref strTemp);
              htmlUtil.ConvertHTMLToAnsi(strTemp, out strTemp);
              // strTemp = strTemp.Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;").Replace("'", "&apos;");
            }
              }
            }

              }
              return strTemp.Trim();
        }
Ejemplo n.º 15
0
    public void Parse(string strHTML)
    {
      m_rows.Clear();
      HTMLUtil util = new HTMLUtil();
      string strTag = "";
      int iPosStart = util.FindTag(strHTML, "<table", ref strTag, 0);
      if (iPosStart >= 0)
      {
        iPosStart += (int)strTag.Length;
        int iPosEnd = util.FindClosingTag(strHTML, "table", ref strTag, iPosStart) - 1;
        if (iPosEnd < 0)
        {
          iPosEnd = (int)strHTML.Length;
        }

        string strTable = strHTML.Substring(iPosStart, 1 + iPosEnd - iPosStart);
        int iTableRowStart = 0;
        do
        {
          iTableRowStart = util.FindTag(strTable, "<tr", ref strTag, iTableRowStart);
          if (iTableRowStart >= 0)
          {
            iTableRowStart += (int)strTag.Length;
            int iTableRowEnd = util.FindClosingTag(strTable, "tr", ref strTag, iTableRowStart) - 1;
            if (iTableRowEnd < 0)
              break;
            string strRow = strTable.Substring(iTableRowStart, 1 + iTableRowEnd - iTableRowStart);
            HTMLRow row = new HTMLRow();
            row.Parse(strRow);
            m_rows.Add(row);
            iTableRowStart = iTableRowEnd + 1;
          }
        } while (iTableRowStart >= 0);
      }
    }
Ejemplo n.º 16
0
        public string[] GetDetail(string strUrl, string strPathImg, string strConfigFile, bool saveImage, string preferredLanguage, string personLimit, string titleLimit, string getRoles, string mediafile)
        {
            var datas = new string[80]; // 0-39 = original fields, 40-79 mapped fields
              elements.Clear();
              string strTemp = string.Empty;

              //string strBody = string.Empty;
              //string strBodyDetails2 = string.Empty;
              //string strBodyPersons = string.Empty;
              //string strBodyTitles = string.Empty;
              //string strBodyCertification = string.Empty;
              //string strBodyComment = string.Empty;
              //string strBodyDescription = string.Empty;
              //string strBodyCover = string.Empty;

              string strEncoding = string.Empty; // added for manual encoding override (global setting for all webgrabbing)
              string strEncodingSubPage = string.Empty; // added to override Sub Page encoding
              string strSearchCleanup = string.Empty;

              string strAccept = string.Empty;
              string strUserAgent = string.Empty;
              string strHeaders = string.Empty;

              string strStart = string.Empty;
              string strEnd = string.Empty;
              string strIndex = string.Empty;
              string strPage = string.Empty;

              string strActivePage = string.Empty;
              string absoluteUri;
              string strTitle = string.Empty;
              string strRate = string.Empty;
              string strRate2 = string.Empty;
              string strBasedRate = string.Empty;
              string strParam1 = string.Empty;
              string strParam3 = string.Empty;
              string strParam2 = string.Empty;
              string strMaxItems = string.Empty;
              string strLanguage = string.Empty;
              string strGrabActorRoles = string.Empty;
              bool boolGrabActorRoles = false;
              string allNames = string.Empty;
              string allRoles = string.Empty;
              int iStart = 0;
              int iEnd = 0;

              // Reset all webpage content
              BodyDetail = string.Empty;
              BodyDetail2 = string.Empty;
              BodyLinkGeneric1 = string.Empty;
              BodyLinkGeneric2 = string.Empty;
              BodyLinkImg = string.Empty;
              BodyLinkPersons = string.Empty;
              BodyLinkTitles = string.Empty;
              BodyLinkCertification = string.Empty;
              BodyLinkComment = string.Empty;
              BodyLinkSyn = string.Empty;
              BodyLinkMultiPosters = string.Empty;
              BodyLinkPhotos = string.Empty;
              BodyLinkPersonImages = string.Empty;
              BodyLinkMultiFanart = string.Empty;
              BodyLinkTrailer = string.Empty;
              BodyLinkDetailsPath = string.Empty;

              // reset filesystem content
              MovieDirectory = string.Empty;
              MovieFilename = string.Empty;

              // Recovery parameters
              // Load the configuration file
              var doc = new XmlDocument();
              doc.Load(strConfigFile);
              XmlNode n = doc.ChildNodes[1].FirstChild;

              try { strEncoding = n.SelectSingleNodeFast("Encoding").InnerText; }
              catch (Exception) { strEncoding = ""; }
              try { strAccept = n.SelectSingleNodeFast("Accept").InnerText; }
              catch (Exception) { strAccept = ""; }
              try { strUserAgent = n.SelectSingleNodeFast("UserAgent").InnerText; }
              catch (Exception) { strUserAgent = ""; }
              try { strHeaders = n.SelectSingleNodeFast("Headers").InnerText; }
              catch (Exception) { strHeaders = ""; }
              try { strSearchCleanup = n.SelectSingleNodeFast("SearchCleanup").InnerText; }
              catch (Exception) { strSearchCleanup = ""; }

              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartBody").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndBody").InnerText);

              // Set DetailsPath
              BodyLinkDetailsPath = "<url>" + strUrl + "</url>";
              if (strUrl.LastIndexOf("/", System.StringComparison.Ordinal) > 0)
              {
            BodyLinkDetailsPath += Environment.NewLine;
            BodyLinkDetailsPath += "<baseurl>" + strUrl.Substring(0, strUrl.LastIndexOf("/", System.StringComparison.Ordinal)) + "</baseurl>";
            BodyLinkDetailsPath += Environment.NewLine;
            BodyLinkDetailsPath += "<pageurl>" + strUrl.Substring(strUrl.LastIndexOf("/", System.StringComparison.Ordinal) + 1) + "</pageurl>";
            BodyLinkDetailsPath += Environment.NewLine;
            BodyLinkDetailsPath += "<replacement>" + strUrl.Substring(0, strUrl.LastIndexOf("/", System.StringComparison.Ordinal)) + "%replacement%" + strUrl.Substring(strUrl.LastIndexOf("/", System.StringComparison.Ordinal) + 1) + "</replacement>";
              }

              //Fetch the basic Details page and update DetailsPath, if possible
              if (strUrl.ToLower().StartsWith("http"))
              {
            BodyDetail = GrabUtil.GetPage(strUrl, strEncoding, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent);
              }
              else
              {
            BodyDetail = GrabUtil.GetFileContent(strUrl, strEncoding); // Read page from file !
            string physicalFile = (mediafile != null && File.Exists(mediafile)) ? mediafile : strUrl;
            if (File.Exists(physicalFile))
            {
              MovieDirectory = Path.GetDirectoryName(physicalFile);
              MovieFilename = Path.GetFileNameWithoutExtension(physicalFile);
              // Set DetailsPath
              BodyLinkDetailsPath += Environment.NewLine;
              BodyLinkDetailsPath += "<directory>" + MovieDirectory + "</directory>";
              BodyLinkDetailsPath += Environment.NewLine;
              BodyLinkDetailsPath += "<filename>" + MovieFilename + "</filename>";
              if (MovieDirectory != null)
              {
            string[] files = Directory.GetFiles(MovieDirectory, "*", SearchOption.AllDirectories);

            //foreach (string extension in files.Select(file => Path.GetExtension(file)).Distinct().ToList())
            //{
            //  BodyLinkDetailsPath += Environment.NewLine;
            //  BodyLinkDetailsPath += "<" + extension + "-files>";
            //  foreach (string file in files.Where(file => file.EndsWith("." + extension)).ToList())
            //  {
            //    BodyLinkDetailsPath += Environment.NewLine;
            //    BodyLinkDetailsPath += "<" + extension + ">" + file + "</" + extension + ">";
            //  }
            //  BodyLinkDetailsPath += Environment.NewLine;
            //  BodyLinkDetailsPath += "</" + extension + "-files>";
            //}

            BodyLinkDetailsPath += Environment.NewLine;
            BodyLinkDetailsPath += "<jpg-files>";
            foreach (string file in files.Where(file => file.EndsWith(".jpg")).ToList())
            {
              BodyLinkDetailsPath += Environment.NewLine;
              BodyLinkDetailsPath += "<jpg>" + file + "</jpg>";
            }
            BodyLinkDetailsPath += Environment.NewLine;
            BodyLinkDetailsPath += "</jpg-files>";

            BodyLinkDetailsPath += Environment.NewLine;
            BodyLinkDetailsPath += "<other-files>";
            foreach (string file in files.Where(file => !file.EndsWith(".jpg")).ToList())
            {
              BodyLinkDetailsPath += Environment.NewLine;
              BodyLinkDetailsPath += "<other>" + file + "</other>";
            }
            BodyLinkDetailsPath += Environment.NewLine;
            BodyLinkDetailsPath += "</other-files>";
              }
            }
              }

              var htmlUtil = new HTMLUtil();

              //Si on a au moins la clé de début, on découpe StrBody
              if (strStart != "")
              {
            iStart = BodyDetail.IndexOf(strStart);

            //Si la clé de début a été trouvé
            if (iStart > 0)
            {
              //Si une clé de fin a été paramétrée, on l'utilise si non on prend le reste du body
              iEnd = strEnd != "" ? BodyDetail.IndexOf(strEnd, iStart) : this.BodyDetail.Length;

              //Découpage du body
              iStart += strStart.Length;
              if (iEnd - iStart > 0)
            BodyDetail = BodyDetail.Substring(iStart, iEnd - iStart);
            }
              }

              #region Load Sub Pages into Memory ***** // Will be used for Secondary Website Infos!

              // ***** URL Redirection Details 2 Base Page ***** // Will be used for Secondary Website Infos!
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartDetails2").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndDetails2").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartDetails2").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartDetails2").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyDetails2Index").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyDetails2Page").InnerText);
              try { strEncodingSubPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEncodingDetails2").InnerText); }
              catch (Exception) { strEncodingSubPage = ""; }
              strActivePage = this.LoadPage(strPage);
              if (strStart.Length > 0)
              {
            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
            BodyDetail2 = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent);
              }
              else
            BodyDetail2 = "";

              // ***** URL Redirection Generic 1 *****
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkGeneric1").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndLinkGeneric1").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkGeneric1").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkGeneric1").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkGeneric1Index").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkGeneric1Page").InnerText);
              strActivePage = this.LoadPage(strPage);
              try { strEncodingSubPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEncodingLinkGeneric1").InnerText); }
              catch (Exception) { strEncodingSubPage = ""; }
              if (strStart.Length > 0)
              {
            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
            BodyLinkGeneric1 = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent);
              }
              else
            BodyLinkGeneric1 = "";

              // ***** URL Redirection Generic 2 *****
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkGeneric2").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndLinkGeneric2").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkGeneric2").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkGeneric2").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkGeneric2Index").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkGeneric2Page").InnerText);
              strActivePage = this.LoadPage(strPage);
              try { strEncodingSubPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEncodingLinkGeneric2").InnerText); }
              catch (Exception) { strEncodingSubPage = ""; }
              if (strStart.Length > 0)
              {
            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
            BodyLinkGeneric2 = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent);
              }
              else
            BodyLinkGeneric2 = "";

              // ***** URL Redirection IMG *****
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkImg").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndLinkImg").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkImg").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkImg").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkImgIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkImgPage").InnerText);
              strActivePage = this.LoadPage(strPage);
              try { strEncodingSubPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEncodingLinkImg").InnerText); }
              catch (Exception) { strEncodingSubPage = ""; }
              if (strStart.Length > 0)
              {
            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
            BodyLinkImg = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent);
              }
              else
            BodyLinkImg = "";

              // ***** URL Redirection Persons ***** // Will be used for persons, if available !
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkPersons").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndLinkPersons").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkPersons").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkPersons").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkPersonsIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkPersonsPage").InnerText);
              strActivePage = this.LoadPage(strPage);
              try { strEncodingSubPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEncodingLinkPersons").InnerText); }
              catch (Exception) { strEncodingSubPage = ""; }
              if (strStart.Length > 0)
              {
            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
            BodyLinkPersons = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent);
              }
              else
            BodyLinkPersons = "";

              // ***** URL Redirection Titles ***** // Will be used for TTitle, if available !
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkTitles").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndLinkTitles").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkTitles").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkTitles").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkTitlesIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkTitlesPage").InnerText);
              strActivePage = this.LoadPage(strPage);
              try { strEncodingSubPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEncodingLinkTitles").InnerText); }
              catch (Exception) { strEncodingSubPage = ""; }
              if (strStart.Length > 0)
              {
            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
            BodyLinkTitles = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent);
              }
              else
            BodyLinkTitles = "";

              // ***** URL Redirection Certification ***** // Will be used for Certification Details, if available !
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkCertification").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndLinkCertification").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkCertification").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkCertification").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkCertificationIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkCertificationPage").InnerText);
              strActivePage = this.LoadPage(strPage);
              try { strEncodingSubPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEncodingLinkCertification").InnerText); }
              catch (Exception) { strEncodingSubPage = ""; }
              if (strStart.Length > 0)
              {
            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
            BodyLinkCertification = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent);
              }
              else
            BodyLinkCertification = "";

              // ***** URL Redirection Comment ***** // Will be used for Comment Details, if available !
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkComment").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndLinkComment").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkComment").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkComment").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkCommentIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkCommentPage").InnerText);
              strActivePage = this.LoadPage(strPage);
              try { strEncodingSubPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEncodingLinkComment").InnerText); }
              catch (Exception) { strEncodingSubPage = ""; }
              if (strStart.Length > 0)
              {
            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
            BodyLinkComment = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent);
              }
              else
            BodyLinkComment = "";

              // ***** URL Redirection Description ***** // Will be used for Description Details, if available !
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkSyn").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndLinkSyn").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkSyn").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkSyn").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkSynIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkSynPage").InnerText);
              strActivePage = this.LoadPage(strPage);
              try { strEncodingSubPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEncodingLinkSyn").InnerText); }
              catch (Exception) { strEncodingSubPage = ""; }
              if (strStart.Length > 0)
              {
            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
            BodyLinkSyn = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent);
              }
              else
            BodyLinkSyn = "";

              // ***** URL Redirection MultiPosters ***** // Will be used for MultiPosters Details, if available !
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkMultiPosters").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndLinkMultiPosters").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkMultiPosters").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkMultiPosters").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkMultiPostersIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkMultiPostersPage").InnerText);
              strActivePage = this.LoadPage(strPage);
              try { strEncodingSubPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEncodingLinkMultiPosters").InnerText); }
              catch (Exception) { strEncodingSubPage = ""; }
              if (strStart.Length > 0)
              {
            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
            BodyLinkMultiPosters = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent);
              }
              else
            BodyLinkMultiPosters = "";

              // ***** URL Redirection Photos ***** // Will be used for Photos Details, if available !
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkPhotos").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndLinkPhotos").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkPhotos").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkPhotos").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkPhotosIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkPhotosPage").InnerText);
              strActivePage = this.LoadPage(strPage);
              try { strEncodingSubPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEncodingLinkPhotos").InnerText); }
              catch (Exception) { strEncodingSubPage = ""; }
              if (strStart.Length > 0)
              {
            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
            BodyLinkPhotos = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent);
              }
              else
            BodyLinkPhotos = "";

              // ***** URL Redirection PersonImages ***** // Will be used for PersonImages Details, if available !
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkPersonImages").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndLinkPersonImages").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkPersonImages").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkPersonImages").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkPersonImagesIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkPersonImagesPage").InnerText);
              strActivePage = this.LoadPage(strPage);
              try { strEncodingSubPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEncodingLinkPersonImages").InnerText); }
              catch (Exception) { strEncodingSubPage = ""; }
              if (strStart.Length > 0)
              {
            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
            BodyLinkPersonImages = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent);
              }
              else
            BodyLinkPersonImages = "";

              // ***** URL Redirection MultiFanart ***** // Will be used for MultiFanart Details, if available !
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkMultiFanart").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndLinkMultiFanart").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkMultiFanart").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkMultiFanart").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkMultiFanartIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkMultiFanartPage").InnerText);
              strActivePage = this.LoadPage(strPage);
              try { strEncodingSubPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEncodingLinkMultiFanart").InnerText); }
              catch (Exception) { strEncodingSubPage = ""; }
              if (strStart.Length > 0)
              {
            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
            BodyLinkMultiFanart = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent);
              }
              else
            BodyLinkMultiFanart = "";

              // ***** URL Redirection Trailer ***** // Will be used for Trailer Details, if available !
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkTrailer").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndLinkTrailer").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkTrailer").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLinkTrailer").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkTrailerIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLinkTrailerPage").InnerText);
              strActivePage = this.LoadPage(strPage);
              try { strEncodingSubPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEncodingLinkTrailer").InnerText); }
              catch (Exception) { strEncodingSubPage = ""; }
              if (strStart.Length > 0)
              {
            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
            BodyLinkTrailer = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent);
              }
              else
            BodyLinkTrailer = "";
              #endregion

              #region ************* Now get the detail fields ***************************

              // ***** Original TITLE *****
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartOTitle").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndOTitle").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartOTitle").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartOTitle").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyOTitleIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyOTitlePage").InnerText);
              strActivePage = this.LoadPage(strPage);
              strTitle = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strTitle = strTitle.Replace("\n", "");

              if (strTitle.Length > 0)
            datas[(int)Grabber_Output.OriginalTitle] = strTitle;
              else
            datas[(int)Grabber_Output.OriginalTitle] = "";

              // ***** Translated TITLE *****
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartTTitle").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndTTitle").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartTTitle").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartTTitle").Attributes["Param2"].InnerText);
              strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyTTitleRegExp").InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyTTitleIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyTTitlePage").InnerText);
              try
              { strMaxItems = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyTTitleMaxItems").InnerText); }
              catch (Exception) { strMaxItems = ""; }
              try
              { strLanguage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyTTitleLanguage").InnerText); }
              catch (Exception) { strLanguage = ""; }
              strActivePage = this.LoadPage(strPage);

              // Overrides from MyFilms plugin:
              if (!string.IsNullOrEmpty(preferredLanguage))
            strLanguage = preferredLanguage;
              if (!string.IsNullOrEmpty(titleLimit))
            strMaxItems = titleLimit.ToString();

              allNames = string.Empty;
              allRoles = string.Empty;
              if (strParam1.Length > 0 || strParam3.Length > 0)
            strTitle = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out  allNames, out allRoles).Trim();
              else
            strTitle = GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
              strTitle = strTitle.Replace("\n", "");
              if (strTitle.Length > 0)
            //Translated Title
            datas[(int)Grabber_Output.TranslatedTitle] = strTitle;
              else
            datas[(int)Grabber_Output.TranslatedTitle] = "";
              //else
              //    datas[(int)Grabber_Output.TranslatedTitle] = datas[(int)Grabber_Output.OriginalTitle];
              //if (datas[(int)Grabber_Output.OriginalTitle].Length == 0)
              //    datas[(int)Grabber_Output.OriginalTitle] = datas[(int)Grabber_Output.TranslatedTitle];
              datas[(int)Grabber_Output.TranslatedTitleAllNames] = allNames;
              datas[(int)Grabber_Output.TranslatedTitleAllValues] = allRoles;

              // ***** URL for Image *****
              // ***** Fanart ***** //

              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartImg").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndImg").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartImg").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartImg").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyImgIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyImgPage").InnerText);
              strActivePage = this.LoadPage(strPage);

              datas[(int)Grabber_Output.Fanart] = ""; // Fanart - only for file grabber

              if (strStart.StartsWith("#NFO#") || strEnd.StartsWith("#NFO#")) //
              {
            if (strStart.StartsWith("#NFO#")) // special handling for NFO files
            {
              string covername = strStart.Substring(strStart.IndexOf("#NFO#") + 5);
              if (covername.Contains("#Filename#"))
            covername = covername.Replace("#Filename#", MovieFilename);
              LogMyFilms.Debug("Search nfo cover - try '" + covername + "'");
              // searched for cleaned filename
              if (!File.Exists(MovieDirectory + "\\" + covername))
              {
            if (!string.IsNullOrEmpty(strSearchCleanup))
            {
              covername = GrabUtil.CleanupSearch(covername, strSearchCleanup);
              LogMyFilms.Debug("Search nfo cover - try '" + covername + "'");
            }
              }
              // search for folder.jpg
              if (!File.Exists(MovieDirectory + "\\" + covername))
              {
            if (File.Exists(MovieDirectory + "\\" + "folder.jpg"))
            {
              covername = "folder.jpg";
              LogMyFilms.Debug("Search nfo cover - try '" + covername + "'");
            }
              }
              datas[(int)Grabber_Output.PicturePathLong] = MovieDirectory + "\\" + covername;
              datas[(int)Grabber_Output.PicturePathShort] = covername;

              if (saveImage == true)
              {
            if (string.IsNullOrEmpty(datas[(int)Grabber_Output.OriginalTitle]))
              GrabUtil.CopyCoverArt(strPathImg, MovieDirectory + "\\" + covername, datas[(int)Grabber_Output.TranslatedTitle], out strTemp);
            else
              GrabUtil.CopyCoverArt(strPathImg, MovieDirectory + "\\" + covername, datas[(int)Grabber_Output.OriginalTitle], out strTemp);
            datas[(int)Grabber_Output.PicturePathLong] = strPathImg + "\\" + strTemp;
              }
              datas[(int)Grabber_Output.PicturePathShort] = strTemp;
            }
            if (strEnd.StartsWith("#NFO#")) // special handling for NFO files
            {
              string fanartname = strEnd.Substring(strEnd.IndexOf("#NFO#") + 5);
              if (fanartname.Contains("#Filename#"))
            fanartname = fanartname.Replace("#Filename#", MovieFilename);
              LogMyFilms.Debug("Search nfo fanart - try '" + fanartname + "'");
              // search for cleaned filename
              if (!File.Exists(MovieDirectory + "\\" + fanartname))
              {
            if (!string.IsNullOrEmpty(strSearchCleanup))
            {
              fanartname = GrabUtil.CleanupSearch(fanartname, strSearchCleanup);
              LogMyFilms.Debug("Search nfo fanart - try '" + fanartname + "'");
            }
              }
              // search for fanart.jpg
              if (!File.Exists(MovieDirectory + "\\" + fanartname))
              {
            if (File.Exists(MovieDirectory + "\\" + "fanart.jpg"))
            {
              fanartname = "fanart.jpg";
              LogMyFilms.Debug("Search nfo fanart - try '" + fanartname + "'");
            }
              }
              datas[(int)Grabber_Output.Fanart] = MovieDirectory + "\\" + fanartname;
            }
              }
              else
              {
            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

            strTemp = strTemp.Replace("\n", "");
            if (strTemp.Length > 0)
            {
              datas[(int)Grabber_Output.PictureURL] = strTemp;
              //Picture
              if (saveImage == true)
              {
            if (string.IsNullOrEmpty(datas[(int)Grabber_Output.OriginalTitle]))
              GrabUtil.DownloadCoverArt(strPathImg, strTemp, datas[(int)Grabber_Output.TranslatedTitle], out strTemp);
            else
              GrabUtil.DownloadCoverArt(strPathImg, strTemp, datas[(int)Grabber_Output.OriginalTitle], out strTemp);
            // strTemp = MediaPortal.Util.Utils.FilterFileName(strTemp); // Guzzi: removed, as it could change the filename to an already loaded image, thus breaking the "link".
            datas[(int)Grabber_Output.PicturePathLong] = strPathImg + "\\" + strTemp;
              }
              datas[(int)Grabber_Output.PicturePathShort] = strTemp;
            }
              }

              // ***** Synopsis ***** Description
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartSyn").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndSyn").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartSyn").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartSyn").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeySynIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeySynPage").InnerText);
              strActivePage = this.LoadPage(strPage);

              strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strTemp = strTemp.Replace("\n", "");

              // make sure nonvalid Chars are encoded - e.g.
              //< 	-> 	&lt;
              //> 	-> 	&gt;
              //" 	-> 	&quot;
              //' 	-> 	&apos;
              //& 	-> 	&amp;
              // strTemp = System.Web.HttpUtility.HtmlEncode(strTemp.Replace('’', '\''));
              // strTemp = System.Security.SecurityElement.Escape(strTemp); // alternative way to encode invalid Chars - avoids overhead of Web classes
              // strTemp = GrabUtil.StripIllegalXMLChars(strTemp, "1.1");
              strTemp = strTemp.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;"); // strTemp = strTemp.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;").Replace("'", "&apos;");
              // strTemp = strTemp.Replace("\"", "\'");

              if (strTemp.Length > 0) datas[(int)Grabber_Output.Description] = strTemp;

              NumberFormatInfo provider = new NumberFormatInfo();
              provider.NumberDecimalSeparator = ",";

              // ***** Base rating *****
              strBasedRate = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/BaseRating").InnerText);
              decimal wRate = 0;
              decimal wRate2 = 0;
              decimal wBasedRate = 10;
              try
              { wBasedRate = Convert.ToDecimal(strBasedRate, provider); }
              catch
              { }
              // ***** NOTE 1 ***** Rating 1
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartRate").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndRate").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartRate").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartRate").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyRateIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyRatePage").InnerText);
              strActivePage = this.LoadPage(strPage);
              strRate = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
              strRate = GrabUtil.convertNote(strRate);
              try
              { wRate = (Convert.ToDecimal(strRate, provider) / wBasedRate) * 10; }
              catch
              { }

              // ***** NOTE 2 ***** Rating 2
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartRate2").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndRate2").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartRate2").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartRate2").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyRate2Index").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyRate2Page").InnerText);
              strActivePage = this.LoadPage(strPage);
              strRate2 = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strRate2 = GrabUtil.convertNote(strRate2);

              try
              { wRate2 = (Convert.ToDecimal(strRate2, provider) / wBasedRate) * 10; }
              catch
              { }

              //Calcul de la moyenne des notes.
              decimal resultRate;
              if (wRate > 0 && wRate2 > 0)
            resultRate = ((wRate + wRate2) / 2);
              else
            if (wRate == 0 && wRate2 == 0)
              resultRate = -1;
            else
              resultRate = ((wRate + wRate2));

              resultRate = Math.Round(resultRate, 1);
              strRate = resultRate == -1 ? "" : Convert.ToString(resultRate);

              //Rating (calculated from Rating 1 and 2)
              strRate = strRate.Replace(",", ".");
              datas[(int)Grabber_Output.Rating] = strRate.Replace(",", ".");

              // ***** Acteurs ***** Actors
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartCredits").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndCredits").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartCredits").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartCredits").Attributes["Param2"].InnerText);
              strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCreditsRegExp").InnerText);
              strMaxItems = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCreditsMaxItems").InnerText);
              strGrabActorRoles = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCreditsGrabActorRoles").InnerText);
              boolGrabActorRoles = strGrabActorRoles == "true";
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCreditsIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCreditsPage").InnerText);
              strActivePage = this.LoadPage(strPage);
              strLanguage = "";

              // Overrides from MyFilms plugin:
              if (!string.IsNullOrEmpty(personLimit))
            strMaxItems = personLimit.ToString();
              if (!string.IsNullOrEmpty(getRoles))
              {
            if (getRoles.ToLower() == "true") boolGrabActorRoles = true;
            if (getRoles.ToLower() == "false") boolGrabActorRoles = false;
              }

              allNames = string.Empty;
              allRoles = string.Empty;
              if (strParam1.Length > 0 || strParam3.Length > 0) //
            strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out allNames, out allRoles, boolGrabActorRoles).Trim();
              else
            strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              // strTemp = strTemp.Replace("\n", ""); // removed, as it seems, the "newlines" replacements for #LF# didn't work in AMC and MP
              strTemp = GrabUtil.TrimSpaces(strTemp);
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.Actors] = strTemp;

              // ***** Réalisateur ***** = Director
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartRealise").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndRealise").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartRealise").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartRealise").Attributes["Param2"].InnerText);
              strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyRealiseRegExp").InnerText);
              strMaxItems = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyRealiseMaxItems").InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyRealiseIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyRealisePage").InnerText);
              strActivePage = this.LoadPage(strPage);

              // Overrides from MyFilms plugin:
              if (!string.IsNullOrEmpty(personLimit))
            strMaxItems = personLimit;

              if (strParam1.Length > 0 || strParam3.Length > 0)
            strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems).Trim();
              else
            strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.Director] = strTemp;

              // ***** Producteur ***** Producer // Producers also using MiltiPurpose Secondary page !
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartProduct").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndProduct").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartProduct").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartProduct").Attributes["Param2"].InnerText);
              strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyProductRegExp").InnerText);
              strMaxItems = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyProductMaxItems").InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyProductIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyProductPage").InnerText);
              strActivePage = this.LoadPage(strPage);

              // Overrides from MyFilms plugin:
              if (!string.IsNullOrEmpty(personLimit))
            strMaxItems = personLimit.ToString();

              if (strParam1.Length > 0 || strParam3.Length > 0) // Guzzi: Added param3 to execute matchcollections also !
            strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems).Trim();
              else
            strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.Producer] = strTemp;

              // ***** Année ***** Year
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartYear").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndYear").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartYear").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartYear").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyYearIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyYearPage").InnerText);
              strActivePage = this.LoadPage(strPage);

              strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            if (strTemp.Length >= 4)
              datas[(int)Grabber_Output.Year] = strTemp.Substring(strTemp.Length - 4, 4);
            else
              datas[(int)Grabber_Output.Year] = strTemp; // fallback, if scraping failed

              // ***** Pays ***** Country
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartCountry").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndCountry").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartCountry").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartCountry").Attributes["Param2"].InnerText);
              strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCountryRegExp").InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCountryIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCountryPage").InnerText);
              strActivePage = this.LoadPage(strPage);

              if (strParam1.Length > 0 || strParam3.Length > 0)
            strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3).Trim();
              else
            strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
              {
            strTemp = strTemp.Replace(".", " ");
            strTemp = GrabUtil.TransformCountry(strTemp);
            datas[(int)Grabber_Output.Country] = strTemp;
              }

              // ***** Genre *****
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartGenre").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndGenre").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartGenre").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartGenre").Attributes["Param2"].InnerText);
              strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGenreRegExp").InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGenreIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGenrePage").InnerText);
              strActivePage = this.LoadPage(strPage);

              if (strParam1.Length > 0 || strParam3.Length > 0)
            strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3).Trim();
              else
            strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.Category] = strTemp;

              // ***** URL *****
              datas[(int)Grabber_Output.URL] = strUrl;

              // ***** Writer ***** //
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartWriter").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndWriter").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartWriter").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartWriter").Attributes["Param2"].InnerText);
              strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyWriterRegExp").InnerText);
              strMaxItems = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyWriterMaxItems").InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyWriterIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyWriterPage").InnerText);
              strActivePage = this.LoadPage(strPage);

              // Overrides from MyFilms plugin:
              if (!string.IsNullOrEmpty(personLimit))
            strMaxItems = personLimit.ToString();

              if (strParam1.Length > 0 || strParam3.Length > 0) // Guzzi: Added param3 to execute matchcollections also !
            strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems).Trim();
              else
            strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.Writer] = strTemp;

              // ***** Comment *****
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartComment").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndComment").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartComment").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartComment").Attributes["Param2"].InnerText);
              strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCommentRegExp").InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCommentIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCommentPage").InnerText);
              strActivePage = this.LoadPage(strPage);

              if (strParam1.Length > 0 || strParam3.Length > 0)
            strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3).Trim();
              else
            strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strTemp = strTemp.Replace("\n", " "); // Guzzi: Replace linebreaks with space
              strTemp = strTemp.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;"); // strTemp = strTemp.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;").Replace("'", "&apos;");
              // strTemp = System.Web.HttpUtility.HtmlEncode(strTemp.Replace('’', '\''));
              // strTemp = System.Security.SecurityElement.Escape(strTemp); // alternative way to encode invalid Chars - avoids overhead of Web classes
              // strTemp = strTemp.Replace("\"", "\'");

              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.Comments] = strTemp;

              // ***** Language *****
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLanguage").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndLanguage").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLanguage").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartLanguage").Attributes["Param2"].InnerText);
              try { strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLanguageRegExp").InnerText); }
              catch (Exception) { strParam3 = ""; }

              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLanguageIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyLanguagePage").InnerText);
              strActivePage = this.LoadPage(strPage);

              strTemp = (strParam1.Length > 0 || strParam3.Length > 0)
            ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3).Trim()
            : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.Language] = strTemp;

              // ***** Tagline *****
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartTagline").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndTagline").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartTagline").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartTagline").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyTaglineIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyTaglinePage").InnerText);
              strActivePage = this.LoadPage(strPage);

              strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.Tagline] = strTemp;

              // ***** Certification *****
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartCertification").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndCertification").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartCertification").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartCertification").Attributes["Param2"].InnerText);
              strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCertificationRegExp").InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCertificationIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCertificationPage").InnerText);
              strActivePage = this.LoadPage(strPage);
              try
              { strLanguage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCertificationLanguage").InnerText); }
              catch (Exception) { strLanguage = ""; }

              // Overrides from MyFilms plugin:
              if (!string.IsNullOrEmpty(preferredLanguage))
            strLanguage = preferredLanguage;

              allNames = string.Empty;
              allRoles = string.Empty;
              if (strParam1.Length > 0 || strParam3.Length > 0)
            strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3, "", strLanguage, out allNames, out allRoles).Trim();
              else
            strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.Certification] = strTemp;
              datas[(int)Grabber_Output.CertificationAllNames] = allNames;
              datas[(int)Grabber_Output.CertificationAllValues] = allRoles;

              // ***** IMDB_Id *****
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartIMDB_Id").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndIMDB_Id").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartIMDB_Id").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartIMDB_Id").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyIMDB_IdIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyIMDB_IdPage").InnerText);
              strActivePage = this.LoadPage(strPage);

              strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.IMDB_Id] = strTemp;

              // ***** IMDB_Rank *****
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartIMDB_Rank").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndIMDB_Rank").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartIMDB_Rank").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartIMDB_Rank").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyIMDB_RankIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyIMDB_RankPage").InnerText);
              strActivePage = this.LoadPage(strPage);

              strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.IMDB_Rank] = strTemp;

              // ***** TMDB_Id *****
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartTMDB_Id").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndTMDB_Id").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartTMDB_Id").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartTMDB_Id").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyTMDB_IdIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyTMDB_IdPage").InnerText);
              strActivePage = this.LoadPage(strPage);

              strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.TMDB_Id] = strTemp;

              // ***** Studio *****
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartStudio").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndStudio").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartStudio").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartStudio").Attributes["Param2"].InnerText);
              try { strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStudioRegExp").InnerText); }
              catch (Exception) { strParam3 = ""; }
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStudioIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStudioPage").InnerText);
              strActivePage = this.LoadPage(strPage);

              strTemp = (strParam1.Length > 0 || strParam3.Length > 0)
            ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3).Trim()
            : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.Studio] = strTemp;

              // ***** Edition *****
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartEdition").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndEdition").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartEdition").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartEdition").Attributes["Param2"].InnerText);
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEditionIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEditionPage").InnerText);
              strActivePage = this.LoadPage(strPage);

              strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.Edition] = strTemp;

              // ***** Collection *****
              try
              {
            strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartCollection").InnerText);
            strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndCollection").InnerText);
            strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartCollection").Attributes["Param1"].InnerText);
            strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartCollection").Attributes["Param2"].InnerText);
            strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCollectionIndex").InnerText);
            strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCollectionPage").InnerText);
            strActivePage = this.LoadPage(strPage);

            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

            strTemp = strTemp.Replace("\n", "");
            if (strTemp.Length > 0)
              datas[(int)Grabber_Output.Collection] = strTemp;
              }
              catch (Exception)
              {
            datas[(int)Grabber_Output.Collection] = "";
              }

              // ***** Collection Image *****
              try
              {
            strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartCollectionImageURL").InnerText);
            strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndCollectionImageURL").InnerText);
            strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartCollectionImageURL").Attributes["Param1"].InnerText);
            strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartCollectionImageURL").Attributes["Param2"].InnerText);
            strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCollectionImageURLIndex").InnerText);
            strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyCollectionImageURLPage").InnerText);
            strActivePage = this.LoadPage(strPage);

            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

            strTemp = strTemp.Replace("\n", "");
            if (strTemp.Length > 0)
            {
              datas[(int)Grabber_Output.CollectionImage] = strTemp;
              //Picture for Collections Download
              if (saveImage == true)
              {
            if (string.IsNullOrEmpty(datas[(int)Grabber_Output.OriginalTitle]))
              GrabUtil.DownloadCoverArt(strPathImg, strTemp, "Collection_" + datas[(int)Grabber_Output.TranslatedTitle], out strTemp);
            else
              GrabUtil.DownloadCoverArt(strPathImg, strTemp, "Collection_" + datas[(int)Grabber_Output.OriginalTitle], out strTemp);
            // datas[(int)Grabber_Output.PicturePathLong] = strPathImg + "\\" + strTemp;
              }
              // datas[(int)Grabber_Output.PicturePathShort] = strTemp;
            }
              }
              catch (Exception)
              {
            datas[(int)Grabber_Output.CollectionImage] = "";
              }

              // ***** Runtime *****
              try
              {
            strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartRuntime").InnerText);
            strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndRuntime").InnerText);
            strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartRuntime").Attributes["Param1"].InnerText);
            strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartRuntime").Attributes["Param2"].InnerText);
            strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyRuntimeIndex").InnerText);
            strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyRuntimePage").InnerText);
            strActivePage = this.LoadPage(strPage);

            strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();

            strTemp = strTemp.Replace("\n", "");
            if (strTemp.Length > 0)
              datas[(int)Grabber_Output.Runtime] = strTemp;
              }
              catch (Exception)
              {
            datas[(int)Grabber_Output.Runtime] = "";
              }

              // ***** Generic Field 1 ***** //
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartGeneric1").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndGeneric1").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartGeneric1").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartGeneric1").Attributes["Param2"].InnerText);
              strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGeneric1RegExp").InnerText);
              try
              { strMaxItems = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGeneric1MaxItems").InnerText); }
              catch (Exception) { strMaxItems = ""; }
              try
              { strLanguage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGeneric1Language").InnerText); }
              catch (Exception) { strLanguage = ""; }
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGeneric1Index").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGeneric1Page").InnerText);
              strActivePage = this.LoadPage(strPage);

              // Overrides from MyFilms plugin:
              //if (!string.IsNullOrEmpty(PreferredLanguage)) strLanguage = PreferredLanguage;
              //if (!string.IsNullOrEmpty(TitleLimit)) strMaxItems = TitleLimit.ToString();
              //if (!string.IsNullOrEmpty(PersonLimit)) strMaxItems = PersonLimit.ToString();

              allNames = string.Empty;
              allRoles = string.Empty;
              if (strParam1.Length > 0 || strParam3.Length > 0)
            strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out  allNames, out allRoles).Trim();
              else
            strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
              strTemp = strTemp.Replace("\n", "");
              strTemp = GrabUtil.StripIllegalXMLChars(strTemp, "1.0"); // strTemp = strTemp.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;"); // strTemp = strTemp.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;").Replace("'", "&apos;");

              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.Generic1] = strTemp;
              else
            datas[(int)Grabber_Output.Generic1] = "";

              // ***** Generic Field 2 ***** //
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartGeneric2").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndGeneric2").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartGeneric2").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartGeneric2").Attributes["Param2"].InnerText);
              strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGeneric2RegExp").InnerText);
              try
              { strMaxItems = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGeneric2MaxItems").InnerText); }
              catch (Exception) { strMaxItems = ""; }
              try
              { strLanguage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGeneric2Language").InnerText); }
              catch (Exception) { strLanguage = ""; }
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGeneric2Index").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGeneric2Page").InnerText);
              strActivePage = this.LoadPage(strPage);

              // Overrides from MyFilms plugin:
              //if (!string.IsNullOrEmpty(PreferredLanguage)) strLanguage = PreferredLanguage;
              //if (!string.IsNullOrEmpty(TitleLimit)) strMaxItems = TitleLimit.ToString();
              //if (!string.IsNullOrEmpty(PersonLimit)) strMaxItems = PersonLimit.ToString();

              allNames = string.Empty;
              allRoles = string.Empty;
              if (strParam1.Length > 0 || strParam3.Length > 0)
            strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out  allNames, out allRoles).Trim();
              else
            strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
              strTemp = strTemp.Replace("\n", "");
              strTemp = GrabUtil.StripIllegalXMLChars(strTemp, "1.0"); // strTemp = strTemp.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;"); // strTemp = strTemp.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;").Replace("'", "&apos;");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.Generic2] = strTemp;
              else
            datas[(int)Grabber_Output.Generic2] = "";

              // ***** Generic Field 3 ***** //
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartGeneric3").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndGeneric3").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartGeneric3").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartGeneric3").Attributes["Param2"].InnerText);
              strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGeneric3RegExp").InnerText);
              try
              { strMaxItems = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGeneric3MaxItems").InnerText); }
              catch (Exception) { strMaxItems = ""; }
              try
              { strLanguage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGeneric3Language").InnerText); }
              catch (Exception) { strLanguage = ""; }
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGeneric3Index").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyGeneric3Page").InnerText);
              strActivePage = this.LoadPage(strPage);

              // Overrides from MyFilms plugin:
              //if (!string.IsNullOrEmpty(PreferredLanguage)) strLanguage = PreferredLanguage;
              //if (!string.IsNullOrEmpty(TitleLimit)) strMaxItems = TitleLimit.ToString();
              //if (!string.IsNullOrEmpty(PersonLimit)) strMaxItems = PersonLimit.ToString();

              allNames = string.Empty;
              allRoles = string.Empty;
              if (strParam1.Length > 0 || strParam3.Length > 0)
            strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out  allNames, out allRoles).Trim();
              else
            strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
              strTemp = strTemp.Replace("\n", "");
              strTemp = GrabUtil.StripIllegalXMLChars(strTemp, "1.0"); // strTemp = strTemp.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;"); // strTemp = strTemp.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;").Replace("'", "&apos;");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.Generic3] = strTemp;
              else
            datas[(int)Grabber_Output.Generic3] = "";

              // ***********************************
              // new key-value listingoutputs
              // ***********************************

              // ***** MultiPosters ***** //
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartMultiPosters").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndMultiPosters").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartMultiPosters").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartMultiPosters").Attributes["Param2"].InnerText);
              strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyMultiPostersRegExp").InnerText);
              try
              { strMaxItems = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyMultiPostersMaxItems").InnerText); }
              catch (Exception) { strMaxItems = ""; }
              try
              { strLanguage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyMultiPostersLanguage").InnerText); }
              catch (Exception) { strLanguage = ""; }
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyMultiPostersIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyMultiPostersPage").InnerText);
              strActivePage = this.LoadPage(strPage);

              // Overrides from MyFilms plugin:
              //if (!string.IsNullOrEmpty(PreferredLanguage)) strLanguage = PreferredLanguage;
              //if (!string.IsNullOrEmpty(TitleLimit)) strMaxItems = TitleLimit.ToString();
              //if (!string.IsNullOrEmpty(PersonLimit)) strMaxItems = PersonLimit.ToString();

              allNames = string.Empty;
              allRoles = string.Empty;
              if (strParam1.Length > 0 || strParam3.Length > 0)
            strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out  allNames, out allRoles, true).Trim();
              else
            strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.MultiPosters] = strTemp;
              else
            datas[(int)Grabber_Output.MultiPosters] = "";

              // ***** Photos ***** //
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartPhotos").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndPhotos").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartPhotos").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartPhotos").Attributes["Param2"].InnerText);
              strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyPhotosRegExp").InnerText);
              try
              { strMaxItems = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyPhotosMaxItems").InnerText); }
              catch (Exception) { strMaxItems = ""; }
              try
              { strLanguage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyPhotosLanguage").InnerText); }
              catch (Exception) { strLanguage = ""; }
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyPhotosIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyPhotosPage").InnerText);
              strActivePage = this.LoadPage(strPage);

              // Overrides from MyFilms plugin:
              //if (!string.IsNullOrEmpty(PreferredLanguage)) strLanguage = PreferredLanguage;
              //if (!string.IsNullOrEmpty(TitleLimit)) strMaxItems = TitleLimit.ToString();
              //if (!string.IsNullOrEmpty(PersonLimit)) strMaxItems = PersonLimit.ToString();

              allNames = string.Empty;
              allRoles = string.Empty;
              if (strParam1.Length > 0 || strParam3.Length > 0)
            strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out  allNames, out allRoles, true).Trim();
              else
            strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.Photos] = strTemp;
              else
            datas[(int)Grabber_Output.Photos] = "";

              // ***** PersonImages ***** //
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartPersonImages").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndPersonImages").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartPersonImages").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartPersonImages").Attributes["Param2"].InnerText);
              strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyPersonImagesRegExp").InnerText);
              try
              { strMaxItems = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyPersonImagesMaxItems").InnerText); }
              catch (Exception) { strMaxItems = ""; }
              try
              { strLanguage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyPersonImagesLanguage").InnerText); }
              catch (Exception) { strLanguage = ""; }
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyPersonImagesIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyPersonImagesPage").InnerText);
              strActivePage = this.LoadPage(strPage);

              // Overrides from MyFilms plugin:
              //if (!string.IsNullOrEmpty(PreferredLanguage)) strLanguage = PreferredLanguage;
              //if (!string.IsNullOrEmpty(TitleLimit)) strMaxItems = TitleLimit.ToString();
              //if (!string.IsNullOrEmpty(PersonLimit)) strMaxItems = PersonLimit.ToString();

              allNames = string.Empty;
              allRoles = string.Empty;
              if (strParam1.Length > 0 || strParam3.Length > 0)
            strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out  allNames, out allRoles, true).Trim();
              else
            strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.PersonImages] = strTemp;
              else
            datas[(int)Grabber_Output.PersonImages] = "";

              // ***** MultiFanart ***** //
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartMultiFanart").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndMultiFanart").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartMultiFanart").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartMultiFanart").Attributes["Param2"].InnerText);
              strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyMultiFanartRegExp").InnerText);
              try
              { strMaxItems = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyMultiFanartMaxItems").InnerText); }
              catch (Exception) { strMaxItems = ""; }
              try
              { strLanguage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyMultiFanartLanguage").InnerText); }
              catch (Exception) { strLanguage = ""; }
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyMultiFanartIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyMultiFanartPage").InnerText);
              strActivePage = this.LoadPage(strPage);

              // Overrides from MyFilms plugin:
              //if (!string.IsNullOrEmpty(PreferredLanguage)) strLanguage = PreferredLanguage;
              //if (!string.IsNullOrEmpty(TitleLimit)) strMaxItems = TitleLimit.ToString();
              //if (!string.IsNullOrEmpty(PersonLimit)) strMaxItems = PersonLimit.ToString();

              allNames = string.Empty;
              allRoles = string.Empty;
              if (strParam1.Length > 0 || strParam3.Length > 0)
            strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out  allNames, out allRoles, true).Trim();
              else
            strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.MultiFanart] = strTemp;
              else
            datas[(int)Grabber_Output.MultiFanart] = "";

              // ***** Trailer ***** //
              strStart = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartTrailer").InnerText);
              strEnd = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyEndTrailer").InnerText);
              strParam1 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartTrailer").Attributes["Param1"].InnerText);
              strParam2 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyStartTrailer").Attributes["Param2"].InnerText);
              strParam3 = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyTrailerRegExp").InnerText);
              try
              { strMaxItems = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyTrailerMaxItems").InnerText); }
              catch (Exception) { strMaxItems = ""; }
              try
              { strLanguage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyTrailerLanguage").InnerText); }
              catch (Exception) { strLanguage = ""; }
              strIndex = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyTrailerIndex").InnerText);
              strPage = XmlConvert.DecodeName(n.SelectSingleNodeFast("Details/KeyTrailerPage").InnerText);
              strActivePage = this.LoadPage(strPage);

              // Overrides from MyFilms plugin:
              //if (!string.IsNullOrEmpty(PreferredLanguage)) strLanguage = PreferredLanguage;
              //if (!string.IsNullOrEmpty(TitleLimit)) strMaxItems = TitleLimit.ToString();
              //if (!string.IsNullOrEmpty(PersonLimit)) strMaxItems = PersonLimit.ToString();

              allNames = string.Empty;
              allRoles = string.Empty;
              if (strParam1.Length > 0 || strParam3.Length > 0)
            strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, n), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out  allNames, out allRoles, true).Trim();
              else
            strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, n), strStart, strEnd).Trim();
              strTemp = strTemp.Replace("\n", "");
              if (strTemp.Length > 0)
            datas[(int)Grabber_Output.Trailer] = strTemp;
              else
            datas[(int)Grabber_Output.Trailer] = "";
              #endregion

              #region mapping of fields to output
              // **********************************************************************************************************
              // Do mapping, if any configured...
              // **********************************************************************************************************
              string[] source = new string[40];
              string[] destination = new string[40];
              bool[] replace = new bool[40];
              bool[] addStart = new bool[40];
              bool[] addEnd = new bool[40];
              bool[] mergePreferSource = new bool[40];
              bool[] mergePreferDestination = new bool[40];

              List<string> fields = Grabber.Grabber_URLClass.FieldList();

              // Read Config
              for (int t = 0; t < 40; t++)
              {
            try
            {
              source[t] = XmlConvert.DecodeName(n.SelectSingleNodeFast("Mapping/Field_" + t.ToString()).Attributes["source"].InnerText);
              if (source[t] == "") source[t] = fields[t]; // replace with "right DB field name" if it is empty (for upgrade compatibility)
              destination[t] = XmlConvert.DecodeName(n.SelectSingleNodeFast("Mapping/Field_" + t.ToString()).Attributes["destination"].InnerText);
              replace[t] = Convert.ToBoolean(XmlConvert.DecodeName(n.SelectSingleNodeFast("Mapping/Field_" + t.ToString()).Attributes["replace"].InnerText));
              addStart[t] = Convert.ToBoolean(XmlConvert.DecodeName(n.SelectSingleNodeFast("Mapping/Field_" + t.ToString()).Attributes["addstart"].InnerText));
              addEnd[t] = Convert.ToBoolean(XmlConvert.DecodeName(n.SelectSingleNodeFast("Mapping/Field_" + t.ToString()).Attributes["addend"].InnerText));
              mergePreferSource[t] = Convert.ToBoolean(XmlConvert.DecodeName(n.SelectSingleNodeFast("Mapping/Field_" + t.ToString()).Attributes["mergeprefersource"].InnerText));
              mergePreferDestination[t] = Convert.ToBoolean(XmlConvert.DecodeName(n.SelectSingleNodeFast("Mapping/Field_" + t.ToString()).Attributes["mergepreferdestination"].InnerText));
            }
            catch (Exception)
            {
              source[t] = fields[t];
              destination[t] = "";
              replace[t] = false;
              addStart[t] = false;
              addEnd[t] = false;
              mergePreferSource[t] = false;
              mergePreferDestination[t] = false;
            }
              }

              for (int t = 0; t < 40; t++) // set default values = source
              {
            datas[t + 40] = !string.IsNullOrEmpty(datas[t]) ? datas[t] : string.Empty; // set destination = source as default (base if no other transformations)
              }
              for (int t = 0; t < 40; t++) // replace values if configured
              {
            for (int i = 0; i < 40; i++) // search for mapping destination
            {
              if (destination[t] == source[i]) // found mapping destination -> datas[i] is destination object !
              {
            if (replace[t]) // replace action
              datas[i + 40] = !String.IsNullOrEmpty(datas[t]) ? datas[t] : string.Empty;
              }
            }
              }
              for (int t = 0; t < 40; t++) // merge prefer source - replace values only if source is not empty
              {
            for (int i = 0; i < 40; i++)
            {
              if (destination[t] == source[i])
              {
            if (mergePreferSource[t] && !string.IsNullOrEmpty(datas[t])) // replace action
              datas[i + 40] = datas[t];
              }
            }
              }
              for (int t = 0; t < 40; t++) // merge prefer destination - replace values only if destination empty
              {
            for (int i = 0; i < 40; i++)
            {
              if (destination[t] == source[i])
              {
            if (mergePreferDestination[t] && string.IsNullOrEmpty(datas[i])) // replace action
              datas[i + 40] = datas[t];
              }
            }
              }
              for (int t = 0; t < 40; t++) // insert or append values if configured
              {
            for (int i = 0; i < 40; i++) // search for mapping destination
            {
              if (destination[t] == source[i]) // found mapping destination -> datas[i] is destination object !
              {
            if (addStart[t] && !string.IsNullOrEmpty(datas[t])) // addStart action - only of not empty (avoid empty new line)
              datas[i + 40] = datas[t] + System.Environment.NewLine + datas[i + 40];
            if (addEnd[t] && !string.IsNullOrEmpty(datas[t])) // addEnd action - only if not empty (avoid empty new line)
              datas[i + 40] = datas[i + 40] + System.Environment.NewLine + datas[t];
              }
            }
              }
              #endregion

              return datas;
        }