private void mniAdultEmpire_Click(object sender, RoutedEventArgs e)
        {
            Cursor = Cursors.Wait;
            string error;

            ArtistServices.GetInfoFromWeb(artistDetail.Artist, true, Provider.AduldtDvdEmpire, out error, true);

            if (string.IsNullOrEmpty(error) == false)
            {
                new MessageBoxYesNo(error, false, true).ShowDialog();
            }

            artistDetail.Refresh();

            Cursor = null;
        }
        private void cmdUpdateWeb_Click(object sender, RoutedEventArgs e)
        {
            Cursor = Cursors.Wait;
            string error = string.Empty;

            if (artistDetail.Artist != null)
            {
                ArtistServices.GetInfoFromWeb(artistDetail.Artist, true, artistDetail.EntityType, out error, true);
            }

            if (string.IsNullOrWhiteSpace(error))
            {
                artistDetail.Refresh();
            }
            else
            {
                Cursor = null;
                new MessageBoxYesNo(error, false, true).ShowDialog();
            }

            Cursor = null;
        }
Beispiel #3
0
        public static Hashtable Parse(string strUrl, bool getPage, string strSearch)
        {
            Hashtable objResuls = new Hashtable();

            try
            {
                string strResults;

                if (getPage == true)
                {
                    strResults = Util.GetHtmlPage(strUrl, Encoding.UTF8);
                }
                else
                {
                    strResults = strUrl;
                }

                objResuls.Add("Title", strSearch);
                objResuls.Add("Links", strUrl);

                if (string.IsNullOrEmpty(strResults))
                {
                    return(null);
                }
                #region Image
                string strParsing = @"more-views";
                int    intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intBegin > -1)
                {
                    strResults = strResults.Substring(intBegin + strParsing.Length);
                    strParsing = @"href=""";
                    strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                    strParsing = @"""";

                    objResuls.Add("Image", strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)));
                }
                #endregion
                #region Background
                strParsing = @"href=""";
                intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intBegin > -1)
                {
                    strResults = strResults.Substring(intBegin + strParsing.Length);
                    strParsing = @"""";

                    objResuls.Add("Background", strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)));
                }
                #endregion
                #region Director
                strParsing = @"Réalisateur :";
                intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intBegin > -1)
                {
                    strResults = strResults.Substring(intBegin + strParsing.Length);
                    strParsing = @"dd>";
                    strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                    strParsing = @"<";
                    objResuls.Add("Directed", strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)).Trim());
                }
                #endregion
                #region Studio
                strParsing = @"Marque :";
                intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intBegin > -1)
                {
                    strResults = strResults.Substring(intBegin + strParsing.Length);
                    strParsing = @"dd>";
                    strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                    strParsing = @"<";
                    objResuls.Add("Studio", strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)).Trim());
                }
                #endregion
                #region Released
                strParsing = @"Année :";
                intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intBegin > -1)
                {
                    strResults = strResults.Substring(intBegin + strParsing.Length);
                    strParsing = @"dd>";
                    strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                    strParsing = @"<";
                    string strTemp = strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.InvariantCulture)).Trim();
                    int    date;
                    if (int.TryParse(strTemp, out date) == true)
                    {
                        objResuls.Add("Released", new DateTime(date, 1, 1));
                    }
                }
                #endregion
                #region Actors
                strParsing = @"Actrice :";
                intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intBegin > -1)
                {
                    strResults = strResults.Substring(intBegin + strParsing.Length);
                    strParsing = @"</dd>";
                    intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                    if (intBegin > -1)
                    {
                        string strActors = strResults.Substring(0, intBegin);
                        strParsing = @"dd>";
                        strActors  = strActors.Substring(strActors.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                        strParsing = @",";

                        string[]      objTables = strActors.Split(new [] { strParsing }, StringSplitOptions.RemoveEmptyEntries);
                        List <Artist> lstActors = new List <Artist>();

                        foreach (string item in objTables)
                        {
                            if (string.IsNullOrEmpty(item.Trim()) == false)
                            {
                                string name = item.Trim();
                                bool   isNew;
                                Artist artist = (ArtistServices.Get(name, out isNew));

                                if (MySettings.FastSearch == false)
                                {
                                    string errorMessage;
                                    ArtistServices.GetInfoFromWeb(artist, false, Provider.Iafd, out errorMessage, false);
                                }

                                lstActors.Add(artist);
                            }
                        }

                        objResuls.Add("Actors", lstActors);
                    }
                }
                #endregion
                #region Runtime
                strParsing = @"Durée :";
                intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intBegin > -1)
                {
                    strResults = strResults.Substring(intBegin + strParsing.Length);
                    strParsing = @"dd>";
                    strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                    strParsing = @"<";
                    objResuls.Add("Runtime", strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)).Trim());
                }
                #endregion
                #region Description
                strParsing = @"Description :";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"<p>";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"</p>";
                intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intBegin > -1)
                {
                    objResuls.Add("Description", Util.PurgeHtml(strResults.Substring(0, intBegin)));
                }
                #endregion
                return(objResuls);
            }
            catch (Exception ex)
            {
                Util.LogException(ex, strUrl);
                return(null);
            }
        }
        public static Hashtable Parse(string strUrl, bool getPage, string strSearch)
        {
            Hashtable objResuls = new Hashtable();

            try
            {
                string strResults;

                if (getPage == true)
                {
                    strResults = Util.GetHtmlPage(strUrl, Encoding.Default);
                }
                else
                {
                    strResults = strUrl;
                }

                string[] objTables;

                objResuls.Add("Title", strSearch);
                objResuls.Add("Links", strUrl);
                #region Publisher
                string strParsing = @"Studio / Publisher:  ";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.InvariantCulture) + strParsing.Length);
                strParsing = @">";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.InvariantCulture) + strParsing.Length);
                strParsing = @"<";

                objResuls.Add("Studio", strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.InvariantCulture)));
                #endregion
                #region Image
                strParsing = @"id=""COVER:";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"src=""";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"""";

                objResuls.Add("Image", "http://e.orgazmik.com" + strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)));
                #endregion
                #region Directed
                strParsing = @"<strong>Director</strong>";
                int intTmp = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intTmp > -1)
                {
                    strResults = strResults.Substring(intTmp + strParsing.Length);
                    strParsing = @"#183D74"">";
                    strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                    strParsing = @"</td>";

                    objResuls.Add("Directed", strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)));
                }
                #endregion
                #region Actors
                strParsing = @"<strong>Actors</strong>";
                intTmp     = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intTmp > -1)
                {
                    strResults = strResults.Substring(intTmp + strParsing.Length);
                    strParsing = @"#183D74"">";
                    strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                    strParsing = @"</td>";
                    string strActors = strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal));
                    strParsing = @",";

                    objTables = strActors.Split(new[] { strParsing }, StringSplitOptions.RemoveEmptyEntries);
                    List <Artist> lstActors = new List <Artist>();

                    foreach (string item in objTables)
                    {
                        if (string.IsNullOrEmpty(item.Trim()) == false)
                        {
                            bool   isNew;
                            Artist actor = ArtistServices.Get(item.Trim(), out isNew);

                            if (MySettings.FastSearch == false)
                            {
                                string errorMessage;
                                ArtistServices.GetInfoFromWeb(actor, false, Provider.Iafd, out errorMessage, false);
                            }

                            lstActors.Add(actor);
                        }
                    }

                    objResuls.Add("Actors", lstActors);
                }
                #endregion
                #region Genres
                strParsing = @"<strong>Categories</strong>";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"#183D74"">";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"</td>";

                string strGenres = strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal));
                strParsing = @"<a href=";

                objTables = strGenres.Split(new[] { strParsing }, StringSplitOptions.RemoveEmptyEntries);
                List <string> lstGenres = new List <string>();

                foreach (string item in objTables)
                {
                    if (string.IsNullOrEmpty(item.Trim()) == false &&
                        item.StartsWith(@"""/film"))
                    {
                        strParsing = @">";
                        string strTemp = item.Trim().Substring(item.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                        strParsing = @"<";
                        lstGenres.Add(strTemp.Substring(0, strTemp.IndexOf(strParsing, StringComparison.Ordinal)));
                    }
                }
                objResuls.Add("Genre", lstGenres);
                #endregion
                #region Released
                strParsing = @"Catalog Date: ";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);

                objResuls.Add("Released", strResults.Substring(0, 10));
                #endregion
                #region RunTime
                intTmp = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intTmp > -1)
                {
                    strParsing = @"<strong>Length:</strong>";
                    strResults = strResults.Substring(intTmp + strParsing.Length);
                    strParsing = @"Min.";
                    intTmp     = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                    if (intTmp > -1)
                    {
                        objResuls.Add("Runtime", strResults.Substring(0, intTmp).Trim());
                    }
                }

                #endregion
                return(objResuls);
            }
            catch (Exception ex)
            {
                Util.LogException(ex, strUrl);
                return(null);
            }
        }
Beispiel #5
0
        public static Hashtable Parse(string strUrl, bool getPage)
        {
            Hashtable objResuls = new Hashtable();

            try
            {
                string strResults;
                string strTemp;

                if (getPage)
                {
                    strResults = Util.GetHtmlPage(strUrl, Encoding.UTF8);
                }
                else
                {
                    strResults = strUrl;
                }

                objResuls.Add("Links", strUrl);
                #region Released
                string strParsing = @"Movie Year: ";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"<br />";

                objResuls.Add("Released", strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)));
                #endregion
                #region Studio
                strParsing = @"<a href=";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @">";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"</a>";

                objResuls.Add("Studio", strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)));
                #endregion
                #region Genres
                strParsing = @"Genres:";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"Director:";
                int intTemp = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intTemp == -1)
                {
                    strParsing = @"Starring:";
                    intTemp    = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                }
                if (intTemp == -1)
                {
                    strParsing = @"E-mail this movie to a friend";
                    intTemp    = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                }
                string strGenres = strResults.Substring(0, intTemp);
                strParsing = @"<a href=";

                string[]      objTables = strGenres.Split(new[] { strParsing }, StringSplitOptions.RemoveEmptyEntries);
                List <string> lstGenres = new List <string>();

                foreach (string item in objTables)
                {
                    if (string.IsNullOrEmpty(item.Trim()) == false &&
                        item.Contains(" Our Picks!") == false &&
                        item.Contains(@"adult-"))
                    {
                        strParsing = @">";
                        strTemp    = item.Trim().Substring(item.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                        strParsing = @"<";
                        lstGenres.Add(strTemp.Substring(0, strTemp.IndexOf(strParsing, StringComparison.Ordinal)));
                    }
                }
                objResuls.Add("Genre", lstGenres);
                #endregion
                #region Director
                strParsing = @"Director:";
                intTemp    = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intTemp > -1)
                {
                    strResults = strResults.Substring(intTemp + strParsing.Length);
                    strParsing = @">";
                    strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                    strParsing = @"</a>";

                    objResuls.Add("Directed", strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)));
                }
                #endregion
                #region Actors
                strParsing = @"Starring:";

                intTemp = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intTemp > -1)
                {
                    strResults = strResults.Substring(intTemp + strParsing.Length);
                    strParsing = @"<a style";

                    intTemp = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                    if (intTemp > -1)
                    {
                        string strActors = strResults.Substring(0, intTemp);
                        strParsing = @"<a href=";

                        objTables = strActors.Split(new[] { strParsing }, StringSplitOptions.RemoveEmptyEntries);
                        List <Artist> lstActors = new List <Artist>();

                        foreach (string item in objTables)
                        {
                            if (string.IsNullOrEmpty(item.Trim()) == false && item.Contains(@"adult-"))
                            {
                                strParsing = @">";
                                strTemp    = item.Trim().Substring(item.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                                strParsing = @"<";

                                string name = strTemp.Substring(0, strTemp.IndexOf(strParsing, StringComparison.Ordinal));

                                bool   isNew;
                                Artist artist = (ArtistServices.Get(name, out isNew));

                                if (MySettings.FastSearch == false)
                                {
                                    string errorMessage;
                                    ArtistServices.GetInfoFromWeb(artist, false, Provider.Iafd, out errorMessage, false);
                                }

                                lstActors.Add(artist);
                            }
                        }

                        objResuls.Add("Actors", lstActors);
                    }
                }
                #endregion
                #region Image
                strParsing = @"name=""ProductPic";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"src=""";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"""";
                strTemp    = strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal));
                objResuls.Add("Image", "http://www.adultblurayhddvd.com/" + strTemp);
                #endregion
                #region Background
                objResuls.Add("Background", "http://www.adultblurayhddvd.com/" + strTemp.Replace(@"/medium/", "/large/"));
                #endregion
                #region Description
                strParsing = @"<hr style=""clear:both"" />";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"<";

                if (strResults.IndexOf(strParsing, StringComparison.Ordinal) > -1)
                {
                    strTemp = Util.PurgeHtml(strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)));
                    if (string.IsNullOrWhiteSpace(strTemp) == false)
                    {
                        objResuls.Add("Description", strTemp);
                    }
                }

                #endregion
                return(objResuls);
            }
            catch (Exception ex)
            {
                Util.LogException(ex, strUrl);
                return(null);
            }
        }
Beispiel #6
0
        public static Hashtable Parse(string strUrl, bool getPage)
        {
            Hashtable objResuls = new Hashtable();

            try
            {
                string strResults;
                strUrl = strUrl.Replace(@"/fr/", @"/en/");

                if (getPage)
                {
                    strResults = Util.GetHtmlPage(strUrl, Encoding.Default);
                }
                else
                {
                    strResults = strUrl;
                }
                objResuls.Add("Links", strUrl);
                #region Image
                string strParsing = @"onmouseout=""document.getElementById('cover').src='";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"'";

                string temp = strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal));

                objResuls.Add("Image", temp);
                #endregion
                #region Rating
                strParsing = @"images/stars-";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @".png";

                temp = strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal));
                temp = temp.Replace("-", ".");

                double rating;
                if (double.TryParse(temp, out rating) == true)
                {
                    objResuls.Add("Rating", rating * 4);
                }
                else
                {
                    temp = temp.Replace(".", ",");
                    if (double.TryParse(temp, out rating) == true)
                    {
                        objResuls.Add("Rating", rating * 4);
                    }
                }
                #endregion
                #region Studio
                strParsing = @"Studio:";
                int intTemp = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intTemp > -1)
                {
                    strResults = strResults.Substring(intTemp + strParsing.Length);
                    strParsing = @"title=""";
                    strResults =
                        strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) +
                                             strParsing.Length);
                    strParsing = @"""";
                    temp       = strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)).Trim();
                    if (string.IsNullOrWhiteSpace(temp) == false)
                    {
                        objResuls.Add("Studio", temp);
                    }
                }

                #endregion
                #region Director
                strParsing = @"Director:";
                intTemp    = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intTemp > -1)
                {
                    strResults = strResults.Substring(intTemp + strParsing.Length);
                    strParsing = @"title=""";
                    strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                    strParsing = @"""";

                    objResuls.Add("Directed", strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)));
                }
                #endregion
                #region RunTime
                strParsing = @"Approximate Running Time:</strong>";
                intTemp    = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intTemp > -1)
                {
                    strResults = strResults.Substring(intTemp + strParsing.Length);
                    strParsing = @"duration";
                    strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                    strParsing = @">";
                    strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                    strParsing = @"<";
                    temp       = strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)).Trim();
                    if (string.IsNullOrWhiteSpace(temp) == false)
                    {
                        TimeSpan time;
                        if (TimeSpan.TryParse(temp, out time))
                        {
                            objResuls.Add("Runtime", time.TotalMinutes);
                        }
                    }
                }
                #endregion
                #region Released
                strParsing = @"Released:</strong>";
                intTemp    = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intTemp > -1)
                {
                    strResults = strResults.Substring(intTemp + strParsing.Length);
                    strParsing = @">";
                    strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                    strParsing = @"<";

                    temp = Util.PurgeHtml(strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)));
                    if (string.IsNullOrEmpty(temp) == false)
                    {
                        DateTime date;
                        if (DateTime.TryParseExact(temp, "yyyy", new CultureInfo("en-US"), DateTimeStyles.None, out date))
                        {
                            objResuls.Add("Released", date);
                        }
                    }
                }
                #endregion
                #region Description
                strParsing = @"class=""video_description""";
                intTemp    = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intTemp > -1)
                {
                    strResults = strResults.Substring(intTemp + strParsing.Length);
                    strParsing = @">";
                    strResults =
                        strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) +
                                             strParsing.Length);
                    strParsing = @"<span id=";

                    objResuls.Add("Description",
                                  Util.PurgeHtml(strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal))));
                }

                #endregion
                #region Genre
                strParsing = @"Categories";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"</div>";
                string strGenres = strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal));
                strParsing = @"title=";

                string[]      objTables = strGenres.Split(new[] { strParsing }, StringSplitOptions.RemoveEmptyEntries);
                List <string> lstGenres = new List <string>();

                foreach (string item in objTables)
                {
                    if (string.IsNullOrEmpty(item.Trim()) == false && item.StartsWith(":") == false)
                    {
                        strParsing = @"->";
                        intTemp    = item.IndexOf(strParsing, StringComparison.Ordinal);
                        if (intTemp > -1)
                        {
                            string strTemp = item.Trim().Substring(intTemp + strParsing.Length);
                            strParsing = @"""";
                            lstGenres.Add(strTemp.Substring(0, strTemp.IndexOf(strParsing, StringComparison.Ordinal)));
                        }
                    }
                }
                objResuls.Add("Genre", lstGenres);
                #endregion
                #region Background
                strParsing = @"<img class=""shot""";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"src=""";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"""";

                temp = strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal));
                if (string.IsNullOrWhiteSpace(temp) == false)
                {
                    objResuls.Add("Background", temp);
                }
                #endregion
                #region Actors
                strParsing = @"Stars:";
                intTemp    = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intTemp > -1)
                {
                    strResults = strResults.Substring(intTemp + strParsing.Length);
                    strParsing = @"</div>";

                    intTemp = strResults.IndexOf(strParsing, StringComparison.CurrentCultureIgnoreCase);
                    if (intTemp > -1)
                    {
                        string[]      strActors = strResults.Substring(0, intTemp).Split(new string[] { @"<a href=""" }, StringSplitOptions.RemoveEmptyEntries);
                        List <Artist> lstActors = new List <Artist>();
                        Parallel.ForEach(strActors, item =>
                        {
                            if (item.StartsWith(@"http://"))
                            {
                                strParsing  = @"title=""";
                                string name =
                                    item.Substring(item.IndexOf(strParsing, StringComparison.Ordinal) +
                                                   strParsing.Length);
                                strParsing = @"""";
                                name       = name.Substring(0, name.IndexOf(strParsing, StringComparison.Ordinal));

                                bool isNew;
                                Artist artist = (ArtistServices.Get(name, out isNew));
                                if (MySettings.FastSearch == false)
                                {
                                    string errorMessage;
                                    ArtistServices.GetInfoFromWeb(artist, false, Provider.Iafd, out errorMessage, false);
                                }

                                lstActors.Add(artist);
                            }
                        });
                        if (lstActors.Count > 0)
                        {
                            objResuls.Add("Actors", lstActors);
                        }
                    }
                }
                #endregion
                return(objResuls);
            }
            catch (Exception ex)
            {
                Util.LogException(ex, strUrl);
                return(null);
            }
        }
Beispiel #7
0
        public static Hashtable Parse(string strUrl, bool getPage, string strSearch)
        {
            Hashtable objResuls = new Hashtable();

            try
            {
                string   strResults;
                string   strTemp;
                string[] objTables;

                if (getPage == true)
                {
                    strResults = Util.GetHtmlPage(strUrl, Encoding.Default, BrowserType.Firefox10, true);
                }
                else
                {
                    strResults = strUrl;
                }

                objResuls.Add("Title", strSearch);
                objResuls.Add("Links", strUrl);

                if (string.IsNullOrEmpty(strResults))
                {
                    return(null);
                }

                #region Image
                string strParsing = @"/images.asp?pid=";
                int    intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);

                if (intBegin > -1)
                {
                    strResults = strResults.Substring(intBegin);
                    strParsing = @"""";
                    strTemp    = strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal));
                    string imagePage = Util.GetHtmlPage(@"http://www.cduniverse.com/" + strTemp.Replace("amp;", ""), Encoding.Default, BrowserType.Firefox10, true);

                    if (string.IsNullOrWhiteSpace(imagePage) == false)
                    {
                        strParsing = @"<center><p><img src=""";
                        imagePage  = imagePage.Substring(imagePage.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                        strParsing = @"""";


                        objResuls.Add("Image", imagePage.Substring(0, imagePage.IndexOf(strParsing, StringComparison.Ordinal)));
                    }
                }
                #endregion
                #region Genres
                strParsing = @"nobr>Category </nobr>";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"<nobr>Director </nobr>";
                intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);

                if (intBegin == -1)
                {
                    strParsing = @"<nobr>Starring </nobr>";
                }

                intBegin = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intBegin > -1)
                {
                    string strGenres = strResults.Substring(0, intBegin);

                    strParsing = @"href=";

                    objTables = strGenres.Split(new[] { strParsing }, StringSplitOptions.RemoveEmptyEntries);
                    List <string> lstGenres = new List <string>();

                    foreach (string item in objTables)
                    {
                        strParsing = @">";
                        strTemp    = item.Trim().Substring(item.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                        strParsing = @"<";
                        strTemp    = strTemp.Substring(0, strTemp.IndexOf(strParsing, StringComparison.Ordinal));
                        if (string.IsNullOrWhiteSpace(strTemp) == false)
                        {
                            lstGenres.Add(Util.PurgeHtml(strTemp));
                        }
                    }
                    objResuls.Add("Genre", lstGenres);
                }

                #endregion
                #region Director
                strParsing = @"<nobr>Director </nobr>";
                int intTemp = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intTemp > -1)
                {
                    strResults = strResults.Substring(intTemp + strParsing.Length);
                    strParsing = @""">";
                    strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                    strParsing = @"<";
                    objResuls.Add("Directed", strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)));
                }
                #endregion
                #region Actors
                strParsing = @"<nobr>Starring </nobr>";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"<!---- trimable --->";
                intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intBegin > -1)
                {
                    string strActors = strResults.Substring(0, intBegin);
                    strParsing = @"categorylink";

                    objTables = strActors.Split(new[] { strParsing }, StringSplitOptions.RemoveEmptyEntries);
                    List <Artist> lstActors = new List <Artist>();

                    foreach (string item in objTables)
                    {
                        if (string.IsNullOrEmpty(item.Trim()) == false &&
                            item.StartsWith(@"' href="))
                        {
                            strParsing = @">";
                            strTemp    = item.Trim().Substring(item.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                            strParsing = @"<";
                            string name = strTemp.Substring(0, strTemp.IndexOf(strParsing, StringComparison.Ordinal));
                            bool   isNew;
                            Artist artist = (ArtistServices.Get(name, out isNew));
                            if (MySettings.FastSearch == false)
                            {
                                string errorMessage;
                                ArtistServices.GetInfoFromWeb(artist, false, Provider.Iafd, out errorMessage, false);
                            }

                            lstActors.Add(artist);
                        }
                    }


                    objResuls.Add("Actors", lstActors);
                }
                #endregion
                #region Description
                strParsing = @"<span itemprop=""description"">";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"</span>";
                intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intBegin > -1)
                {
                    objResuls.Add("Description", Util.PurgeHtml(strResults.Substring(0, intBegin)));
                }
                #endregion
                #region Publisher
                strParsing = @"<nobr>Studio </nobr>";
                intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intBegin > -1)
                {
                    strResults = strResults.Substring(intBegin + strParsing.Length);
                    strParsing = @""">";
                    strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                    strParsing = @"</a></td>";

                    objResuls.Add("Studio", strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)));
                }
                #endregion
                #region Released
                strParsing = @"<nobr>Release Date </nobr>";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.InvariantCulture) + strParsing.Length);
                strParsing = @"<td>";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.InvariantCulture) + strParsing.Length);
                strParsing = @"</td>";

                objResuls.Add("Released", strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.InvariantCulture)));
                #endregion
                #region Background
                strParsing = @"class='screenshot'";
                intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intBegin > -1)
                {
                    strResults = strResults.Substring(intBegin + strParsing.Length);
                    strParsing = @"src='";
                    intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                    strResults = strResults.Substring(intBegin + strParsing.Length);
                    strParsing = @"'";
                    intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                    if (intBegin > -1)
                    {
                        objResuls.Add("Background", strResults.Substring(0, intBegin));
                    }
                }
                #endregion
                #region Rating
                strParsing = @"Average Rating:";
                intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intBegin > -1)
                {
                    strResults = strResults.Substring(intBegin + strParsing.Length);
                    strParsing = @"(";
                    intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                    strResults = strResults.Substring(intBegin + strParsing.Length);
                    strParsing = @"out";
                    intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                    if (intBegin > -1)
                    {
                        strTemp = strResults.Substring(0, intBegin);
                        if (int.TryParse(strTemp, out intBegin) == true)
                        {
                            objResuls.Add("Rating", intBegin * 4);
                        }
                    }
                }
                #endregion
                #region Comments
                strParsing = @"reviewtext";
                intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intBegin > -1)
                {
                    strResults = strResults.Substring(intBegin + strParsing.Length);
                    strParsing = @">";
                    intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                    strResults = strResults.Substring(intBegin + strParsing.Length);
                    strParsing = @"<";
                    intBegin   = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                    if (intBegin > -1)
                    {
                        objResuls.Add("Comments", Util.PurgeHtml(strResults.Substring(0, intBegin)));
                    }
                }
                #endregion

                return(objResuls);
            }
            catch (Exception ex)
            {
                Util.LogException(ex, strUrl);
                return(null);
            }
        }
        public static Hashtable Parse(string strUrl, bool getPage, string strSearch)
        {
            Hashtable objResuls = new Hashtable();

            try
            {
                string strResults;
                string temp;

                if (getPage)
                {
                    strResults = Util.GetHtmlPage(strUrl, Encoding.Default);
                }
                else
                {
                    strResults = strUrl;
                }

                objResuls.Add("Title", strSearch);
                objResuls.Add("Links", strUrl);
                #region Studio
                string strParsing = @"<SPAN CLASS=""details_title_studio_text"">";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @">";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"</A>";

                objResuls.Add("Studio", strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)));
                #endregion
                #region Image
                strParsing = @"<a id=""productimg_1""";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"<img src=""";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @""" name=";

                objResuls.Add("Image", strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)));
                #endregion
                #region Rating
                strParsing = @"Avg Rating";
                int intTemp = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intTemp > -1)
                {
                    strResults = strResults.Substring(intTemp + strParsing.Length);
                    strParsing = @"</B>";
                    strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                    strParsing = @"stars";
                    temp       = strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal));

                    double rating;
                    if (double.TryParse(temp, out rating) == true)
                    {
                        objResuls.Add("Rating", (double?)(rating * 4));
                    }
                    else
                    {
                        temp = temp.Replace(".", ",");
                        if (double.TryParse(temp, out rating) == true)
                        {
                            objResuls.Add("Rating", (double?)(rating * 4));
                        }
                    }
                }
                #endregion
                #region Background
                strParsing = @"javascript:goLoginPage";
                intTemp    = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intTemp > -1)
                {
                    strResults = strResults.Substring(intTemp + strParsing.Length);

                    strParsing = @"SRC=""";
                    strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                    strParsing = @"""";

                    temp = strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal));
                    if (string.IsNullOrWhiteSpace(temp) == false)
                    {
                        objResuls.Add("Background", temp.Replace("_sm", "_hu"));
                    }
                }
                #endregion
                #region Description
                strParsing = @"Synopsis:</B></TD><TD ALIGN=""left"">";
                intTemp    = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intTemp > -1)
                {
                    strResults = strResults.Substring(intTemp + strParsing.Length);
                    strParsing = @"</TD>";

                    objResuls.Add("Description", Util.PurgeHtml(strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal))));
                }
                #endregion
                #region RunTime
                strParsing = @"<B>Running Time:</B></TD><TD ALIGN=""left"">";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"</TD>";
                string strTemp = strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal));
                strParsing = @"minutes";
                if (strTemp.IndexOf(strParsing, StringComparison.Ordinal) > -1)
                {
                    objResuls.Add("Runtime", strTemp.Substring(0, strTemp.IndexOf(strParsing, StringComparison.Ordinal)));
                }
                #endregion
                #region Released
                strParsing = @"<B>Added on:</B></TD><TD ALIGN=""left"">";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"</TD>";
                temp       = strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal));
                temp       = temp.Replace("th, ", " ");
                objResuls.Add("Released", temp);
                #endregion
                #region Genre
                strParsing = @"Categories:";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"Directed By:";

                string strGenres = strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal));
                strParsing = @"<A HREF=""";
                string[]      objTables = strGenres.Split(new[] { strParsing }, StringSplitOptions.RemoveEmptyEntries);
                List <string> lstGenres = new List <string>();

                foreach (string item in objTables)
                {
                    if (string.IsNullOrEmpty(item.Trim()) == false)
                    {
                        strParsing = @">";
                        strTemp    = item.Trim().Substring(item.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                        strParsing = @"<";
                        string genre = strTemp.Substring(0, strTemp.IndexOf(strParsing, StringComparison.Ordinal));
                        if (string.IsNullOrWhiteSpace(genre) == false)
                        {
                            lstGenres.Add(genre);
                        }
                    }
                }
                objResuls.Add("Genre", lstGenres);

                #endregion
                #region Director
                strParsing = @"<B>Directed By:</B></TD><TD ALIGN=""left"">";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"</TD>";

                objResuls.Add("Directed", strResults.Substring(0, strResults.IndexOf(strParsing, StringComparison.Ordinal)));
                #endregion
                #region Actors
                strParsing = @"Starring:</B></TD><TD ALIGN=""left""><A HREF=""";
                strResults = strResults.Substring(strResults.IndexOf(strParsing, StringComparison.Ordinal) + strParsing.Length);
                strParsing = @"</A></TD></TR></TABLE>";
                intTemp    = strResults.IndexOf(strParsing, StringComparison.Ordinal);
                if (intTemp > -1)
                {
                    string[]      strActors = strResults.Substring(0, intTemp).Split(new[] { @"http:" }, StringSplitOptions.RemoveEmptyEntries);
                    List <Artist> lstActors = new List <Artist>();
                    Parallel.ForEach(strActors, item =>
                    {
                        strTemp = item;
                        if (strTemp.StartsWith(@"//"))
                        {
                            strParsing = ">";
                            strTemp    =
                                strTemp.Substring(strTemp.IndexOf(strParsing, StringComparison.Ordinal) +
                                                  strParsing.Length);
                            strParsing = "<";
                            intTemp    = strTemp.IndexOf(strParsing, StringComparison.CurrentCultureIgnoreCase);
                            if (intTemp > -1)
                            {
                                string name = strTemp.Substring(0, intTemp);
                                bool isNew;
                                Artist artist = (ArtistServices.Get(name, out isNew));
                                if (MySettings.FastSearch == false)
                                {
                                    string errorMessage;
                                    ArtistServices.GetInfoFromWeb(artist, false, Provider.Iafd, out errorMessage, false);
                                }

                                lstActors.Add(artist);
                            }
                        }
                    });
                    if (lstActors.Count > 0)
                    {
                        objResuls.Add("Actors", lstActors);
                    }
                }

                #endregion
                return(objResuls);
            }
            catch (Exception ex)
            {
                Util.LogException(ex, strUrl);
                return(null);
            }
        }