[Approved] IMDB.com (default info grabber) (2 Viewers)

rjburke377

Portal Member
March 24, 2008
15
0
Ottawa
Home Country
Canada Canada
In latest SVN i add support for scripting using CS-Script from CS-Script
in this may find some example of scripts, but basically every script are a standalone class.

I prototyped the following C# code in IMDB.cs to support "aliases". Should I change the script instead?

Code:
    private void FindIMDB(string strURL, int iLimit)
    {
      string absoluteUri;
      string httpPage = GetPage(strURL, "utf-8", out absoluteUri);
      string httpString = System.Web.HttpUtility.HtmlDecode(httpPage);
      Match imdbEntry = Regex.Match(
        httpString,
        @"<tr>[\s]*
          <td[^>]*>.*?</td>[\s]*
          <td[^>]*>.*?</td>[\s]*
          <td[^>]*>.*?
            <a\shref=""(?<tt>/title/tt[0-9]*/)[^>]*>(?<title>.*?)</a>
            (?<options>.*?)[\s]*
            (?(?=<br>)(?<aka><br>.*?))
          </td>[\s]*
          </tr>",
        RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | RegexOptions.Compiled);

      while (imdbEntry.Success)
      {
        string imdbTitle = imdbEntry.Groups["title"].Value.Replace("\"", "");
        string imdbURL = imdbEntry.Groups["tt"].Value;
        string imdbOptions = Regex.Replace(imdbEntry.Groups["options"].Value, @"<(.|\n)*?>", String.Empty,
                                            RegexOptions.IgnoreCase | RegexOptions.Compiled);
        IMDBUrl url = new IMDBUrl(@"http://us.imdb.com" + imdbURL, imdbTitle + @" " + imdbOptions + @" (imdb)", @"IMDB");
        elements.Add(url);
        imdbEntry = imdbEntry.NextMatch();

        string imdbAka = imdbEntry.Groups["aka"].Value;
        Match imdbAlias = Regex.Match(imdbAka, @"<br>\saka\s<em>""(?<alias>.*?)""</em>", RegexOptions.IgnoreCase | RegexOptions.Compiled);
        while (imdbAlias.Success)
        {
          imdbTitle = imdbAlias.Groups["alias"].Value;
          url = new IMDBUrl(@"http://us.imdb.com" + imdbURL, imdbTitle + @" " + imdbOptions + @" (imdb)", @"IMDB");
          elements.Add(url);
          imdbAlias = imdbAlias.NextMatch();
        }
      }
    }
My favorite western is "The Good, The Bad, and the Ugly". Without this change I have to re-name the file to "Buono, il brutto, il cattivo., Il" to get an IMDB match. The above code adds aliases to the list of results so I can use the US english title instead of the published Italian name.

Rick
 

Spaldo

MP Donator
  • Premium Supporter
  • May 7, 2008
    495
    12
    FlashFXP Development Team
    Home Country
    ok - as promised here is a script file that is really just a merge of the imdb_com and MovieXML scripts. It will basically download all the movie details from IMDB but will grab the artwork from moviexml.

    sorry for the delay - seems like imdb.com were having some issues on friday meaning i could perform tests on the script until today!!.

    Hello,

    I have been using this script since posting my previous problems... It has been working great, with the exception of one bug/issue I have noticied.

    If any sentance in the description/summary section starts with an I after a full stop, it will not recover any further words.

    For example if the Summary was as follows.

    "The bunny walked down the street and got hit by a truck. I "

    Once the I starts a sentance, it will not recover anything further.

    If you need more info let me know, it would be great to continue using your script s7oneyuk
     

    emphatic

    Design Group
  • Team MediaPortal
  • August 25, 2006
    3,728
    1,185
    Alingsås
    Home Country
    Sweden Sweden
    I've noticed the "I" phenomenon as well. I just thought it was badly updated info. Now I know better. Hope this can be fixed.

    Emph
     

    swe_rush

    MP Donator
  • Premium Supporter
  • July 8, 2008
    28
    0
    Home Country
    Sweden Sweden
    ok - as promised here is a script file that is really just a merge of the imdb_com and MovieXML scripts. It will basically download all the movie details from IMDB but will grab the artwork from moviexml.

    sorry for the delay - seems like imdb.com were having some issues on friday meaning i could perform tests on the script until today!!.

    Hello,

    I have been using this script since posting my previous problems... It has been working great, with the exception of one bug/issue I have noticied.

    If any sentance in the description/summary section starts with an I after a full stop, it will not recover any further words.

    For example if the Summary was as follows.

    "The bunny walked down the street and got hit by a truck. I "

    Once the I starts a sentance, it will not recover anything further.

    If you need more info let me know, it would be great to continue using your script s7oneyuk
    thanks s7oneyuk for great script its awesome. but i have also the problem with the "I" phenomenon, hoping you can correct this =).

    have a other question also, i am having problem to get database to find the movie "P2" why is that? when search on "P2" on The Internet Movie Database (IMDb) it hits as an Exact match. so if i want to add P2 i have to search tt0804516 and then it finds it.
     

    s7oneyuk

    Portal Member
    December 20, 2007
    24
    11
    Home Country
    United Kingdom United Kingdom
    can you give me an example film name to look at for the 'I' problem. As for the other issue - this is also something i'm working on. Basically the script i produced was nothing more than an insert of the movie xml graphics with the imdb info. With the original imdb script it will return a list of Popular titles if they exist - if not it will then fall through to exact matches! This seems a bit daft to me - so i was going to re-work it based on popular and exact matches - probably in the other order though !!
     

    swe_rush

    MP Donator
  • Premium Supporter
  • July 8, 2008
    28
    0
    Home Country
    Sweden Sweden
    can you give me an example film name to look at for the 'I' problem. As for the other issue - this is also something i'm working on. Basically the script i produced was nothing more than an insert of the movie xml graphics with the imdb info. With the original imdb script it will return a list of Popular titles if they exist - if not it will then fall through to exact matches! This seems a bit daft to me - so i was going to re-work it based on popular and exact matches - probably in the other order though !!

    my titles are : Black Sheep, Colleage Road Trip, Drillbit Taylor, Good.Luck.Chuck , Mr.Magoriums.Wonder.Emporium, The.Water.Horse.Legend.of.the.Deep, Waiting < are the ones with the "I" and then just stop.

    and another thing i noticed was that some of the plot/summarys ended with "..."
    for example SAW IV
    "Jigsaw and his apprentice Amanda are dead. Now, upon the news of Detective Kerry's murder, two seasoned FBI profilers... " < looks like that. but when check imdb there is much more information.

    this happens to other movies aswell..
    88 minutes, REC, SAW IV, stomp the yard.


    as for the "P2" its the same with the original imdb script, it returns a list if titles but P2 isnt in it. never gotten that to work. just that movie :/

    yes exact matches should be first alternative not popular.. would be nice if one could choose what option should come first.
     

    s7oneyuk

    Portal Member
    December 20, 2007
    24
    11
    Home Country
    United Kingdom United Kingdom
    actually the 'I' phenomenum is not a result of the script - but actually a result of imdb (its also actually a pipe character | not an i). The plot summary is taken from the Plot line in IMDB. (see Waiting... (2005) or College Road Trip (2008) for an example). The plot field in IMDB is user populated and is quite often very short. If you look at another example (Star Wars (1977)) you can see that the plot is short and if you drill into the full plotsummary (Star Wars (1977) - Plot summary) it contains multiple user entries for the plot. This has always been the problem with the imdb data for some fields.

    The ... entries are if the plot is long and they dont want to waste real estate on the frontpage (Saw IV - Saw IV (2007)) but again if you drill into the plotsummary (Saw IV (2007) - Plot summary) there is more detail - in this case written by the production company. however - looking at the plotsummay for Star Wars (1977) you will see multiple entries all submitted by different imdb members! Which one would we pick!!!

    I will get a new script cut that includes the exact matches 1st in the list and will also try to exclude films that are no-where near the title you are searching for.
     

    gamejester

    Retired Team Member
  • Premium Supporter
  • May 13, 2007
    418
    37
    Home Country
    United Kingdom United Kingdom
    The movie-xml slash issue with quote has now been resolved by Zak so there is no need to use the newer script I posted any more, the old one works again now.

    FYI - For those of you keen to get good covers working with the various different scrits out there I have nearly finished coding up a few things in myVideos which will achieve this.

    1. IMPAwards cover search - enhance so it always finds the correct film + only pulls down 1 copy of each cover (currently adds 2 copies of the main cover to the list)
    2. Cover search chooser - lets the user specify which cover search engine(s) they want to use.
    3. More cover search engines. These will be moviexml, IMPawrds, Amazon, Folder (all the jpg's in the current folder), File (a jpg in the current folder that matches the name of the movie file)

    In this way the script that grabs the movie text details is abstrcted from that the grabs the covers, and so will work with all in built searches and the cscript searches just need to remove any cover search section (unless you want to force overwrite this new method).

    To make it backward compatible if you do not choose any cover searches then it will fall back to IMPAwards.

    It is 90% complete already so should have something out by the weekend.
     

    swe_rush

    MP Donator
  • Premium Supporter
  • July 8, 2008
    28
    0
    Home Country
    Sweden Sweden
    looking at the plotsummay for Star Wars (1977) you will see multiple entries all submitted by different imdb members! Which one would we pick!!!

    first maybe ? =) thats little tricky. is it possible to have the script ask user which one he/she prefeers ? if there ar multiple entries.
     

    gamejester

    Retired Team Member
  • Premium Supporter
  • May 13, 2007
    418
    37
    Home Country
    United Kingdom United Kingdom
    IMDB plot summaries - it is for this reason (and others) I have switched to moviexml to provide the details; as the site is user driven someone has already got the 'best' descriptiong form IMDB and populated it into moviexml. why not just have 2 searches specified, have moviexml first (with will come with all 'modern' movies, it has 250k+ now) and IMDB second to pick up all the really old stuff.

    Feel you are fitting a loosing battle with IMDB, no script is ever going to be able to pull back the data you want for every movie, like s7oneyuk says, if you look at 3 movies with multiple descriptions you would want a different ordered one for each, so how is a script ever going to devided that for you.............whereas on moviexml someone has already made that desission using human reasoning so you get better info back!
     

    Users who are viewing this thread

    Top Bottom