public void GetDirectors(ref IMDbMovie movie, string html) { if (!Settings.GetIMDbMovieDirectors) return; Debugger.LogMessageToFile("[IMDb film details downloader] Extracting Directors..."); // Grab Directors string directorHTML = _imDbRegex.GetRegExString(html, _imDbRegex._directorPattern); if (!String.IsNullOrEmpty(directorHTML.Trim())) { Match match = _imDbRegex.GetRegExMatch(directorHTML, _imDbRegex._personPattern); while (match != null && match.Length > 0) { string personID = _imDbRegex.GetMatchValue(match, "PersonURL", true); if (String.IsNullOrEmpty(personID.Trim())) continue; IIMDbPerson director = movie.People.GetPersonByID(personID); if (director == null) { director = new IMDbPerson(); movie.People.Add(director); } director.URL = personID; director.Name = _imDbRegex.GetMatchValue(match, "PersonName", true); director.IsDirector = true; match = match.NextMatch(); } } string directors = movie.People.GetDirectorString(); Debugger.LogMessageToFile("[IMDb film details downloader] IMDb returned Directors: " + directors); //MessageBox.Show(@"IMDb returned Directors: " + directors); }
internal void MineDirectorUsingRegex(ref IMDbMovie movie, string html) { if (!ImdbFilmDetailsIndividualChoices .GetIMDbMovieDirectors) return; Debugger.LogMessageToFile ("[IMDb film details downloader]" + " Extracting Directors..."); string directorHtml = _imDbRegex.GetRegExString (html, _imDbRegex.DirectorPattern); if (!String.IsNullOrEmpty(directorHtml.Trim())) { Match match = _imDbRegex.GetRegExMatch(directorHtml, _imDbRegex.PersonPattern); while (match != null && match.Length > 0) { string personID = _imDbRegex.GetMatchValue(match, "PersonURL", true); if (String.IsNullOrEmpty(personID.Trim())) continue; IIMDbPerson director = movie.People.GetPersonByID(personID); if (director == null) { director = new IMDbPerson(); movie.People.Add(director); } director.URL = personID; director.Name = _imDbRegex.GetMatchValue(match, "PersonName", true); director.IsDirector = true; match = match.NextMatch(); } } string directors = movie.People.GetDirectorString(); Debugger.LogMessageToFile ("[IMDb film details downloader] " + " IMDb returned Directors: " + directors); //MessageBox.Show(@"IMDb returned Directors: " + directors); }
public void GetActorsUsingRegex(ref IMDbMovie movie, string creditsUrl) { if (!ImdbFilmDetailsIndividualChoices.GetIMDbMovieActors) return; // get cast html string html = HtmlDownloaders.DownloadHTMLfromURL(creditsUrl); // Grab Actors string trimmedHtml = _imDbRegex.GetRegExString(html, _imDbRegex.CastPattern); if (String.IsNullOrEmpty(trimmedHtml.Trim())) return; Match match1 = _imDbRegex.GetRegExMatch(trimmedHtml, _imDbRegex.CastPersonPatternWithCharacterUrLs); while (match1 != null && match1.Length > 0) { string personID = _imDbRegex.GetMatchValue(match1, "PersonURL", true); if (String.IsNullOrEmpty(personID.Trim())) continue; IIMDbPerson actor = movie.People.GetPersonByID(personID); if (actor == null) { actor = new IMDbPerson(); movie.People.Add(actor); } actor.URL = personID; actor.Name = _imDbRegex.GetMatchValue(match1, "PersonName", true); actor.IsActor = true; string characterString = _imDbRegex.GetMatchValue(match1, "CharacterName", true); ParseCharacters(ref actor, characterString); match1 = match1.NextMatch(); } Match match2 = _imDbRegex.GetRegExMatch (trimmedHtml, _imDbRegex.CastPersonPatternWithNoCharacterUrLs); while (match2 != null && match2.Length > 0) { string personID = _imDbRegex.GetMatchValue(match2, "PersonURL", true); if (String.IsNullOrEmpty(personID.Trim())) continue; IIMDbPerson actor = movie.People.GetPersonByID(personID); if (actor == null) { actor = new IMDbPerson(); movie.People.Add(actor); } actor.URL = personID; actor.Name = _imDbRegex.GetMatchValue(match2, "PersonName", true); actor.IsActor = true; string characterString = _imDbRegex.GetMatchValue (match2, "CharacterName", true); ParseCharacters (ref actor, characterString); match2 = match2.NextMatch(); } }
internal static void GetActorsUsingXpath(IMDbMovie movie, string html) { if (!ImdbFilmDetailsIndividualChoices.GetIMDbMovieActors) return; string[] filmStars = Code.Metadata_Scrapers.XPathDataMiners.MatchXpathExpressionReturnAllMatches (html, "//div[@itemprop='actors']//span[@itemprop='name']"); if (filmStars.Length <= 0) return; foreach (var filmStar in filmStars) { IMDbPerson actor = new IMDbPerson(); movie.People.Add(actor); actor.Name = filmStar; actor.IsActor = true; } }
public void MineWriterUsingRegex(ref IMDbMovie movie, string html) { if (!ImdbFilmDetailsIndividualChoices.GetIMDbMovieWriters) return; Debugger.LogMessageToFile("[IMDb film details downloader] Extracting Writers..."); // Grab Writers string writerHtml = _imDbRegex.GetRegExString(html, _imDbRegex.WriterPattern); if (!String.IsNullOrEmpty(writerHtml.Trim())) { Match match = _imDbRegex.GetRegExMatch(writerHtml, _imDbRegex.PersonPattern); while (match != null && match.Length > 0) { string personID = _imDbRegex.GetMatchValue(match, "PersonURL", true); if (String.IsNullOrEmpty(personID.Trim())) continue; IIMDbPerson writer = movie.People.GetPersonByID(personID); if (writer == null) { writer = new IMDbPerson(); movie.People.Add(writer); } writer.URL = personID; writer.Name = _imDbRegex.GetMatchValue(match, "PersonName", true); writer.IsWriter = true; match = match.NextMatch(); } } string writers = movie.People.GetWriterString(); Debugger.LogMessageToFile("[IMDb film details downloader] IMDb returned Writers: " + writers); //MessageBox.Show(@"IMDb returned Writers: " + writers); }
public void MineWriterUsingXpath(ref IMDbMovie movie, string html) { if (!ImdbFilmDetailsIndividualChoices .GetIMDbMovieWriters) return; Debugger.LogMessageToFile ("[IMDb film details downloader] " + "Extracting Writers..."); const string writerXpathExpression = @"//div[@itemprop='creator']//span[@itemprop='name']"; string writerName = Code.Metadata_Scrapers.XPathDataMiners .MatchXpathExpressionReturnFirstMatch (html, writerXpathExpression); IIMDbPerson writer = new IMDbPerson(); movie.People.Add(writer); writer.URL = String.Empty; writer.Name = writerName; writer.IsWriter = true; Debugger.LogMessageToFile ("[IMDb film details downloader] " + "IMDb returned Writers: " + writerName); //MessageBox.Show(@"IMDb returned Writers: " + writerName); }
internal void MineDirectorUsingXpath(ref IMDbMovie movie, string html) { if (!ImdbFilmDetailsIndividualChoices .GetIMDbMovieDirectors) return; Debugger.LogMessageToFile ("[IMDb film details downloader]" + " Extracting Director..."); const string directorXpathExpression = @"//div[@itemprop='director']//span[@itemprop='name']"; string directorName = Code.Metadata_Scrapers.XPathDataMiners .MatchXpathExpressionReturnFirstMatch(html, directorXpathExpression); IIMDbPerson director = new IMDbPerson(); movie.People.Add(director); director.URL = String.Empty; director.Name = directorName; director.IsDirector = true; Debugger.LogMessageToFile ("[IMDb film details downloader] " + " IMDb returned Directors: " + director); //MessageBox.Show(@"IMDb returned Director: " + directorName); }
private void GetActors(ref IMDbMovie movie, string creditsURL) { // get cast html string html = MediaFairy.Downloaders.DownloadHTMLfromURL(creditsURL); // Grab Actors string trimmedHTML = GetRegExString(html, _castPattern); if (trimmedHTML.Trim() != "") { Match match1 = GetRegExMatch(trimmedHTML, _castPersonPatternWithCharacterURLs); while (match1 != null && match1.Length > 0) { string personID = GetMatchValue(match1, "PersonURL", true); if (personID.Trim() != "") { IIMDbPerson actor = movie.People.GetPersonByID(personID); if (actor == null) { actor = new IMDbPerson(); movie.People.Add(actor); } actor.URL = personID; actor.Name = GetMatchValue(match1, "PersonName", true); actor.IsActor = true; string characterString = GetMatchValue(match1, "CharacterName", true); ParseCharacters(ref actor, characterString); match1 = match1.NextMatch(); } } Match match2 = GetRegExMatch(trimmedHTML, _castPersonPatternWithNOCharacterURLs); while (match2 != null && match2.Length > 0) { string personID = GetMatchValue(match2, "PersonURL", true); if (personID.Trim() != "") { IIMDbPerson actor = movie.People.GetPersonByID(personID); if (actor == null) { actor = new IMDbPerson(); movie.People.Add(actor); } actor.URL = personID; actor.Name = GetMatchValue(match2, "PersonName", true); actor.IsActor = true; string characterString = GetMatchValue(match2, "CharacterName", true); ParseCharacters(ref actor, characterString); match2 = match2.NextMatch(); } } } }
private void GetWriters(ref IMDbMovie movie, string html) { // Grab Writers string writerHTML = GetRegExString(html, _writerPattern); if (writerHTML.Trim() != "") { Match match = GetRegExMatch(writerHTML, _personPattern); while (match != null && match.Length > 0) { string personID = GetMatchValue(match, "PersonURL", true); if (personID.Trim() != "") { IIMDbPerson writer = movie.People.GetPersonByID(personID); if (writer == null) { writer = new IMDbPerson(); movie.People.Add(writer); } writer.URL = personID; writer.Name = GetMatchValue(match, "PersonName", true); writer.IsWriter = true; match = match.NextMatch(); } } } }
private void GetDirectors(ref IMDbMovie movie, string html) { // Grab Directors string directorHTML = GetRegExString(html, _directorPattern); if (directorHTML.Trim() != "") { Match match = GetRegExMatch(directorHTML, _personPattern); while (match != null && match.Length > 0) { string personID = GetMatchValue(match, "PersonURL", true); if (personID.Trim() != "") { IIMDbPerson director = movie.People.GetPersonByID(personID); if (director == null) { director = new IMDbPerson(); movie.People.Add(director); } director.URL = personID; director.Name = GetMatchValue(match, "PersonName", true); director.IsDirector = true; match = match.NextMatch(); } } } }