Skip to content

Commit

Permalink
MP1-4980: Add IMDB tt8 support...
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjswan committed Dec 30, 2019
1 parent 5904d3d commit ed210b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ internal class Grabber : MarshalByRefObject, IIMDBScriptGrabber
string regexPattern = string.Empty;

// If string contains tt number use it
if (Regex.Match(strSearch, @"tt\d{7}").Success)
if (Regex.Match(strSearch, @"tt\d{7,8}").Success)
{
string ttNumber = Regex.Match(strSearch, @"(?<imdbID>tt\d{7})").Groups["imdbID"].Value;
string ttNumber = Regex.Match(strSearch, @"(?<imdbID>tt\d{7,8})").Groups["imdbID"].Value;
string imdbUrl = string.Format("http://www.imdb.com/title/{0}", ttNumber);
IMDB.IMDBUrl url = new IMDB.IMDBUrl(imdbUrl, ttNumber, _dbVersion);
elements.Add(url);
Expand Down Expand Up @@ -251,8 +251,8 @@ internal class Grabber : MarshalByRefObject, IIMDBScriptGrabber

// Director
regexBlockPattern = @"<h4[^>]*>[^D]*Director[s]?:[^<]*</h4>[^<]*(?<directors_block>.*?)</div>";
// regexPattern = @"href=""/name/nm\d{7}/[^>]*>(?<movieDirectors>.*?)</a>";
regexPattern = @"href=.\/name\/nm\d{7}(?:\/|\?)[^>]+?>(?:<span[^>]+?>)?(?<movieDirectors>.*?)(?:<\/span>)?<\/a>";
// regexPattern = @"href=""/name/nm\d{7,8}/[^>]*>(?<movieDirectors>.*?)</a>";
regexPattern = @"href=.\/name\/nm\d{7,8}(?:\/|\?)[^>]+?>(?:<span[^>]+?>)?(?<movieDirectors>.*?)(?:<\/span>)?<\/a>";
block = Regex.Match(strBody, regexBlockPattern, RegexOptions.Singleline).Groups["directors_block"].Value;
movieDetails.Director =
Utils.stripHTMLtags(HttpUtility.HtmlDecode(Regex.Match(block, regexPattern, RegexOptions.Singleline).Groups["movieDirectors"].Value));
Expand Down Expand Up @@ -289,8 +289,8 @@ internal class Grabber : MarshalByRefObject, IIMDBScriptGrabber

// Actors
regexBlockPattern = @"<table class=.cast.>.*?<\/table>|<table class=.cast_list.>.*?<\/table>";
// regexPattern = @"href=""/name/nm\d{7}/.*?alt=""(?<actor>.*?)"".*?<td.class=""character"">.*?<div>(?<role>.*?)</div>";
regexPattern = @"href=.\/name\/nm\d{7}\/.*?alt=""(?<actor>.*?)"".*?<td.class=.character.>.*?<a[^>]+?>(?<role>.*?)<\/a>";
// regexPattern = @"href=""/name/nm\d{7,8}/.*?alt=""(?<actor>.*?)"".*?<td.class=""character"">.*?<div>(?<role>.*?)</div>";
regexPattern = @"href=.\/name\/nm\d{7,8}\/.*?alt=""(?<actor>.*?)"".*?<td.class=.character.>.*?<a[^>]+?>(?<role>.*?)<\/a>";
Match castBlock = Regex.Match(strBody, regexBlockPattern, RegexOptions.Singleline);
string strCastBlock = HttpUtility.HtmlDecode(castBlock.Value);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ internal class Grabber : MarshalByRefObject, MediaPortal.Video.Database.IIMDBScr
if (GRABBER_ID_LOOKUP)
{
// Get IMDB ID from search string
Regex rximdbid = new Regex(@"(?:\s|\+|^)(?<imdbid>tt\d{7})\b");
Regex rximdbid = new Regex(@"(?:\s|\+|^)(?<imdbid>tt\d{7,8})\b");
Match matchimdbid = rximdbid.Match(searchStr);
if (matchimdbid.Success)
{
Expand Down

0 comments on commit ed210b8

Please sign in to comment.