[Evaluate] The Movie Database... first script, first trouble (2 Viewers)

megahorst

Super User
  • Team MediaPortal
  • Super User
  • July 8, 2006
    879
    259
    Home Country
    Germany Germany
    Thx for this .

    I have tested this version.

    Much more details are scraped. The age limitations are also there.
    The only thing that I have seen is that movie details with a " do not work. The " is replaced by a \ and the rest is ignored.

    Example:
    http://www.themoviedb.org/movie/9657-otto-der-film
     

    Fred777

    Portal Member
    March 30, 2013
    9
    4
    44
    Home Country
    Switzerland Switzerland
    Hi @lopez.tuparles,

    I had a look at your script as @megahorst told me about it.
    First point is that I didn't noticed the problem with " do not work. The " that you reported @megahorst. The movie Otto - Der film seems to work fine for me, everything (except empty fields of course) are well retrieved. But perhaps I missed something, could you provide a screenshot on configuration tool?

    Second point regarding code is that it could be clearly optimized:
    1. You should not retrieve movie details in FindFilm() (call to GetTMDBMovieDetails()) this can make search very long on some movies, try with "Cars" you will understand
    2. You can really simplify your code using deserialization functionalities of JavaScriptSerializer object to parse JSON. This allow to create a dictionnary in which you can easily navigate to retrieve data. Here is a small code example:

    JavaScriptSerializer deserializer = new JavaScriptSerializer();
    Dictionary<string, object> deserializedDictionary = deserializer.Deserialize<Dictionary<string, object>>(reader.ReadToEnd());
    Dictionary<string, object> movie = deserializedDictionary["movie"] as Dictionary<string, object>;

    if (movie.ContainsKey("title") == true)
    movieDetails.Title = (string)movie["title"];
    else
    movieDetails.Title = (string)movie["originalTitle"];

    (where "movie" is the name of the root object, I don't know its name in TMDB as I have not tested. I used this script for Allocine API data retrieval before they improved their security on the API few days ago)
    This will avoid you to use regular expression and thus avoid data extraction problems. (I hate regular expressions)
    Let me know if you need help on this (you can PM me in French)
    Fred
     
    Last edited:

    megahorst

    Super User
  • Team MediaPortal
  • Super User
  • July 8, 2006
    879
    259
    Home Country
    Germany Germany
    Hello,

    the issue with Otto -Der Film is still there for me.
    @Fred777: Have you switched the script to german language?

    The same is for Elling:
    In tmdb.org i see:
    Ganz normal waren sie noch nie: Elling, der Denker und, wie er sich selbst nennt, das Muttersöhnchen und Kjell, der große stämmige Kerl mit dem Geist eines kleinen Jungen. Nach zwei Jahren Psycho-Quarantäne dürfen sie nun wieder in die "Freiheit" - in ihre eigene WG inmitten des Großstadtdschungels - und müssen sich dort im realen Leben zurechtfinden. Nicht ganz einfach, wenn für Elling schon das Telefonieren, das Einkaufen und überhaupt das Verlassen der Wohnung schwier unüberwindbare Hindernisse darstellen. Kjell dagegen verfolgt weiterhin stoisch seine zwei Ziele: Essen und endlich Sex mit einer Frau zu haben.
    The script fetches the following into the database:
    Ganz normal waren sie noch nie: Elling, der Denker und, wie er sich selbst nennt, das Muttersöhnchen und Kjell, der große stämmige Kerl mit dem Geist eines kleinen Jungen. Nach zwei Jahren Psycho-Quarantäne dürfen sie nun wieder in die \

    What I have also mentioned:
    I have added some movies to the database. The following movies where not found by the script although they are avaliable at tmdb.org:

    "In guten Händen" (the ä?)
    "Nur für Personal!" (the !?)
    "Adams Äpfel" (the Ä?)
    "Fliegende Fische müssen ins Meer" (the ü?)
     
    Last edited:

    megahorst

    Super User
  • Team MediaPortal
  • Super User
  • July 8, 2006
    879
    259
    Home Country
    Germany Germany
    your right about these caracters. Try this new version.;)

    I have tested:
    "In guten Händen"
    "Nur für Personal!"
    "Adams Äpfel"

    Are still not there.
    "Fliegende Fische müssen ins Meer" is found now.

    Movies with " in the description now deliver a better result. The description is there now. Instead of " a \" is scraped.
     

    Wbunaarf

    Portal Pro
    December 9, 2005
    534
    103
    Sweden
    Home Country
    Sweden Sweden
    I have all movies in individual folders. While many of the folders for various reasons have crappy names they are all properly tagged with their IMDB-IDs, e.g. "crappy.name.xyz.xvid.blabla (2013) (tt1234567)". MP recognises the ID, tries to do the search using it and fails.

    I had a quick look at the code and it seems to me as if gettitles(), using Grabber.API_SearchMovie + "?api_key=" + Grabber.API_KEY; where API_SearchMovie = API_BaseUrl + "search/movie";, is always called no matter what it's searching for. I think that in order to search using IMDB IDs you need to use something like API_BaseURL + "movie/" + IMDBID + "?api_key=" + Grabber.API_KEY;. If I'm right, perhaps this could be added?

    //W
     

    lopez.tuparles

    Retired Team Member
  • Premium Supporter
  • July 20, 2006
    396
    54
    49
    Mimet
    Well, it seems your right. it might be possible in TMDB API to add Imdb Id instead of TMDB Id.
    Have a look on first page and set API_IMDB_LOOKUP to true

    Code:
    		#region<<TMDB_PARAMETERS>>
    		public const bool API_IMDB_LOOKUP = false; //IMDB LookUp
    		public const string API_KEY = "......................."; //Insert API Key
    		public const string API_LANG = "fr"; //Change it to change Language
    		private const string API_BaseUrl = "http://api.themoviedb.org/3/";
    		#endregion<<TMDB_PARAMETERS>>
     
    Last edited:

    Wbunaarf

    Portal Pro
    December 9, 2005
    534
    103
    Sweden
    Home Country
    Sweden Sweden
    I just did a Quick test.

    Code:
    		public const bool API_IMDB_LOOKUP = true; //IMDB LookUp
    		public const string API_KEY = "..."; //Inset API Key
    		public const string API_LANG = "sv"; //Change it to change Language

    On my first run I got no hits. The title passed to the script is on the form tt1234567 which the regexp didn't seem to catch. Since I don't really speak regexpish and didn't fully understand what you where doing I simplified it to

    Code:
    System.Text.RegularExpressions.Regex rx = new System.Text.RegularExpressions.Regex(@"tt(?<jocker>\d*)");

    Using this modified regexp I tested on a subset of my movies and it seems to work just fine. I'm currently doing a full scan which should be complete in the morning.

    //W
     

    Wbunaarf

    Portal Pro
    December 9, 2005
    534
    103
    Sweden
    Home Country
    Sweden Sweden
    With the above change most movies seems to have been correctly added. However, 16 of them are named 'unknown'.

    Some, like tt0095226 and tt0095260, simply doesn't seem to exist at tmdb, Should these really be added?

    Some, like tt0268531 and tt0795421, have title, sort title, tagline, studio and country set to unknown while plot, director, writer, rating, actors and genres have proper information.

    //W
     

    azzuro

    Test Group
  • Team MediaPortal
  • May 10, 2007
    9,952
    5,623
    France - IDF
    Home Country
    France France
    i'm sorry guys : we are 2 work for scrapping TMDB what is the good thread ?
    one by @Fred777 and the second by @lopez.tuparles
    Fred work is already ONLINE and no lopez
    but i think we need have only one TMDB for French. and i hope compatible with other country.

    eh les mecs vous bossez ensemble ?
     

    Users who are viewing this thread

    Top Bottom