internal static void IgnoreIrrelevantResults (Match match, IMDbRegEx imDbRegex, IMDbSearchResult result) { //TODO: Also ignore "Making Of" titles. //TODO: Also ignore documentaries (option). string extra = imDbRegex.GetMatchValue (match, "Extra", true); IgnoreVideoGameResult(result, extra); }
internal static List<IIMDbSearchResult> SingleMatchAddToSearchResults (string html, IMDbRegEx imDbRegex, List<IIMDbSearchResult> results) { var titleIndexFound = LocateTitleIndex(html); if (!titleIndexFound) return results; Debugger.LogMessageToFile ("[IMDb Conventional Film Search Engine] " + "A single result was found."); //TODO: Are these RegExes the same as the 'movie result' ones? const string titleAndYearPattern = @"<title>(?<Title>.*?)\((?<Year>.*?)\)</title>"; const string ImdbIdPattern = @"<a\shref=""/title/(?<IMDbID>[^/]*)/fullcredits"""; Match match = imDbRegex.GetRegExMatch(html, titleAndYearPattern); #region Return if no matches were found if (match == null || match.Length == 0) return results; #endregion var result = new IMDbSearchResult { Title = imDbRegex.GetMatchValue(match, "Title", true), Year = imDbRegex.GetMatchValue(match, "Year", true) }; MineImdbIdFromSingleFilmMatch (html, imDbRegex, ImdbIdPattern, result); AddSingleFilmResultToSearchResults (results, result); return results; }
internal static void MineImdbIdFromSingleFilmMatch (string html, IMDbRegEx imDbRegex, string imdbIdPattern, IIMDbSearchResult result) { Match match = imDbRegex.GetRegExMatch(html, imdbIdPattern); if (match != null && match.Length > 0) result.IMDb_ID = imDbRegex.GetMatchValue (match, "IMDbID", true); }
internal static IMDbSearchResult MultipleMatchesMineDetailsOfSingleFilmResult (Match match, IMDbRegEx imDbRegex) { #region Result's details Debugger.LogMessageToFile( "[IMDb Conventional Film Search Engine] " + "New search result was found. " + "Proceeding to add result to the list of total search results..."); var result = new IMDbSearchResult(); result.IMDb_ID = imDbRegex.GetMatchValue (match, "IMDbID", true); Debugger.LogMessageToFile ("[IMDb Conventional Film Search Engine] " + "Result IMDb ID: " + result.IMDb_ID); result.Title = imDbRegex.GetMatchValue (match, "Title", true); Debugger.LogMessageToFile ("[IMDb Conventional Film Search Engine] " + "Result Title: " + result.Title); result.Year = imDbRegex.GetMatchValue (match, "Year", true); Debugger.LogMessageToFile ("[IMDb Conventional Film Search Engine] " + "Result Year: " + result.Year); string URL = imDbRegex.GetMatchValue (match, "URL", true); result.URL = "http://www.imdb.com" + URL; Debugger.LogMessageToFile ("[IMDb Conventional Film Search Engine] " + "Result URL: " + result.URL); #endregion return result; }
internal static void GetRating (IIMDbMovie movie, string trimmedHtml, IMDbRegEx imDbRegEx) { if (!ImdbFilmDetailsIndividualChoices.GetIMDbMovieRatings) return; Debugger.LogMessageToFile ("[IMDb film details downloader]" + " Extracting Rating..."); Match match = imDbRegEx.GetRegExMatch (trimmedHtml, imDbRegEx.RatingPattern); movie.Rating = imDbRegEx.GetMatchValue (match, "Rating", true); Debugger.LogMessageToFile("IMDb returned Rating: " + movie.Rating); }
internal static void GetRuntime (IIMDbMovie movie, string trimmedHTML, IMDbRegEx imDbRegEx) { Debugger.LogMessageToFile ("[IMDb film details downloader]" + " Extracting Runtime..."); Match match = imDbRegEx.GetRegExMatch (trimmedHTML, imDbRegEx.RuntimePattern); string runtime = imDbRegEx.GetMatchValue (match, "Runtime", true); runtime = IMDbMovieDetailsDownloaderHelpers.FixRuntime(runtime); movie.Runtime = runtime; Debugger.LogMessageToFile("IMDb returned Runtime: " + movie.Runtime); //MessageBox.Show("IMDb returned Runtime: " + movie.Runtime); }
internal static void MineProductionYearUsingRegex (IIMDbMovie movie, string trimmedHtml, IMDbRegEx imDbRegEx) { Debugger.LogMessageToFile("[IMDb film details downloader]" + " Extracting Year..."); Match match = imDbRegEx.GetRegExMatch (trimmedHtml, imDbRegEx.YearPattern); movie.Year = imDbRegEx.GetMatchValue (match, "Year", true); movie.Year = movie.Year.TrimEnd('/'); Debugger.LogMessageToFile ("[IMDb film details downloader] " + "IMDb returned Year: " + movie.Year); //MessageBox.Show // ("IMDb returned Year: " + movie.Year); }
internal static void GetTagline (IIMDbMovie movie, string trimmedHTML, IMDbRegEx imDbRegEx) { if (!ImdbFilmDetailsIndividualChoices.GetIMDbMovieTaglines) return; Debugger.LogMessageToFile("Extracting Tagline..."); Match match = imDbRegEx.GetRegExMatch (trimmedHTML, imDbRegEx.TaglinePattern); movie.Tagline = imDbRegEx.GetMatchValue (match, "Tagline", true); Debugger.LogMessageToFile("IMDb returned Tagline: " + movie.Tagline); //MessageBox.Show("IMDb returned Tagline: " + movie.Tagline); }
internal static void GetReleaseDate (IIMDbMovie movie, string trimmedHTML, IMDbRegEx imDbRegEx) { if (!ImdbFilmDetailsIndividualChoices.GetIMDbMovieReleaseDate) return; Debugger.LogMessageToFile("[IMDb film details downloader]" + " Extracting Release Date..."); Match match = imDbRegEx.GetRegExMatch (trimmedHTML, imDbRegEx.ReleaseDatePattern); movie.Release_Date = imDbRegEx.GetMatchValue (match, "ReleaseDate", true); Debugger.LogMessageToFile("[IMDb film details downloader]" + " IMDb returned Release Date: " + movie.Release_Date); //MessageBox.Show("IMDb returned Release Date: " + movie.Release_Date); }
internal static void GetStudio (IMDbMovie movie, string trimmedHtml, IMDbRegEx imDbRegEx) { if (!ImdbFilmDetailsIndividualChoices .GetIMDbMovieProductionStudio) return; Debugger.LogMessageToFile ("[IMDb film details downloader] " + "Extracting Studio..."); Match match = imDbRegEx .GetRegExMatch (trimmedHtml, imDbRegEx.StudioPattern); movie.Studio = imDbRegEx.GetMatchValue (match, "Studio", true); Debugger.LogMessageToFile ("[IMDb film details downloader] " + "IMDb returned Studio: " + movie.Studio); }
internal static void GetReview (IMDbMovie movie, string trimmedHTML, IMDbRegEx imDbRegEx) { if (!ImdbFilmDetailsIndividualChoices.GetIMDbMovieReviews) return; Debugger.LogMessageToFile("[IMDb film details downloader] Extracting Review score..."); Match match = imDbRegEx.GetRegExMatch(trimmedHTML, imDbRegEx.ReviewPattern); movie.Review = imDbRegEx.GetMatchValue(match, "Review", true); if (movie.Review.Contains("/")) movie.Review = movie.Review.Substring(0, movie.Review.IndexOf("/", System.StringComparison.Ordinal)); Debugger.LogMessageToFile("IMDb returned Review: " + movie.Review); }
internal static void ExtractRatingDescription (IMDbMovie movie, string trimmedHTML, IMDbRegEx imDbRegEx) { if (!ImdbFilmDetailsIndividualChoices.GetIMDbMovieRatingDescription) return; Debugger.LogMessageToFile("[IMDb film details downloader] Extracting Rating Description..."); Match match = imDbRegEx.GetRegExMatch (trimmedHTML, imDbRegEx.RatingDescriptionPattern); movie.RatingDescription = imDbRegEx.GetMatchValue (match, "RatingDescription", true); Debugger.LogMessageToFile("[IMDb film details downloader] IMDb returned Rating Description: " + movie.RatingDescription); }
internal static void MineOverviewUsingRegex (IMDbMovie movie, string trimmedHTML, IMDbRegEx imDbRegEx ) { if (!ImdbFilmDetailsIndividualChoices.GetIMDbMovieShortOverview) return; Debugger.LogMessageToFile ("[IMDb film details downloader]" + " Extracting Short Overview..."); Match match = imDbRegEx.GetRegExMatch (trimmedHTML, imDbRegEx.FilmDescriptionPattern); movie.OverviewShort = imDbRegEx.GetMatchValue (match, "ShortOverview", true); if (movie.OverviewShort.ToLower().EndsWith("more")) movie.OverviewShort = movie.OverviewShort.Substring (0, movie.OverviewShort.Length - 4).Trim(); movie.OverviewShort = movie.OverviewShort.Trim() + "..."; Debugger.LogMessageToFile("IMDb returned Overview: " + movie.OverviewShort); }