private void GetGoofs(ref IMDbMovie movie, string goofURL) { // get goof html string html = Downloaders.DownloadHTMLfromURL(goofURL); // Grab goofs Match match = GetRegExMatch(html, _goofPattern); while (match != null && match.Length > 0) { IMDbGoof goof = new IMDbGoof(); goof.Category = GetMatchValue(match, "Category", true); goof.Description = GetMatchValue(match, "Goof", true); movie.Goofs.Add(goof); match = match.NextMatch(); } }
public void GetGoofs(ref IMDbMovie movie, string goofUrl) { if (!ImdbFilmDetailsIndividualChoices.GetIMDbMovieGoofs) return; Debugger.LogMessageToFile("[IMDb film details downloader] Extracting Goofs..."); // get goof html string html = HtmlDownloaders.DownloadHTMLfromURL(goofUrl); // Grab goofs Match match = _imDbRegex.GetRegExMatch(html, _imDbRegex.GoofPattern); while (match != null && match.Length > 0) { IMDbGoof goof = new IMDbGoof(); goof.Category = _imDbRegex.GetMatchValue(match, "Category", true); goof.Description = _imDbRegex.GetMatchValue(match, "Goof", true); movie.Goofs.Add(goof); match = match.NextMatch(); } string goofs = movie.GetGoofsString(); //Debugger.LogMessageToFile("[IMDb film details downloader] IMDb returned Goofs: " + goofs); //MessageBox.Show("IMDb returned Goofs: " + goofs); }
/// <summary> /// Retrieves list of goofs from specified xml file /// </summary> /// <param name="xmlPath">path of xml file to read from</param> public static IList<IIMDbGoof> ReadGoofs( string xmlPath) { try { List<IIMDbGoof> goofs = new List<IIMDbGoof>(); System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load(xmlPath); System.Xml.XmlNodeList goofList = doc.SelectNodes("/Goofs/Goof"); if (goofList != null) foreach (System.Xml.XmlNode goofNode in goofList) { if (goofNode["Category"] != null && goofNode["Category"].InnerText != null && goofNode["Category"].InnerText.Trim() != "" && goofNode["Description"] != null && goofNode["Description"].InnerText != null && goofNode["Description"].InnerText.Trim() != "") { IMDbGoof goof = new IMDbGoof(); goof.Category = goofNode["Category"].InnerText; goof.Description = goofNode["Description"].InnerText; goofs.Add(goof); } } return goofs; } catch (Exception ex) { throw ex; } }